Skip to content

Commit 7c69848

Browse files
committed
refactor(client): Improve robustness and fix mypy issues in client module
This commit introduces a series of refactorings and fixes to the async client module to improve its robustness, maintainability, and type safety. Key changes include: - Replaced brittle msgpack DataFrame serialization with the robust Arrow IPC format in the caching layer. - Simplified cache eviction logic by removing redundant manual TTL management and relying on cachetools built-in functionality. - Consolidated the API for fetching open positions by deprecating `get_positions` in favor of the more consistent `search_open_positions`. - Removed misleading placeholder values from the `get_health_status` method to ensure it returns only accurately tracked metrics. - Hardened the parsing of instrument contract IDs with a more resilient regex-based approach. - Resolved all mypy type-checking errors across the client module, including issues with untyped libraries and mixin protocols.
1 parent 0ae60cb commit 7c69848

File tree

6 files changed

+131
-299
lines changed

6 files changed

+131
-299
lines changed

src/project_x_py/client/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def __init__(
115115

116116
async def __aenter__(self) -> "ProjectXBase":
117117
"""Async context manager entry."""
118-
self._client = await self._create_client()
118+
self._client = await self._create_client() # type: ignore[misc]
119119
return self
120120

121121
async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:

0 commit comments

Comments
 (0)