diff --git a/core/api-doc-config.generated.json b/core/api-doc-config.generated.json index aed18ea4..27c2bd54 100644 --- a/core/api-doc-config.generated.json +++ b/core/api-doc-config.generated.json @@ -1,5 +1,5 @@ { - "_generated": "Auto-generated by extract-jsdoc.js on 2026-06-08T08:08:35.042Z. Do not edit manually.", + "_generated": "Auto-generated by extract-jsdoc.js on 2026-06-08T08:13:19.095Z. Do not edit manually.", "methods": { "has": { "summary": "HTTP verb for the endpoint (e.g. GET, POST). */", diff --git a/core/scripts/generate-python-exchanges.js b/core/scripts/generate-python-exchanges.js index c20458a4..ee0739d9 100644 --- a/core/scripts/generate-python-exchanges.js +++ b/core/scripts/generate-python-exchanges.js @@ -167,7 +167,7 @@ function generateClass(exchange) { } if (creds.signatureType) { const defaultVal = defaults['signature_type'] || 'None'; - constructorParams.push(`signature_type: Optional[Any] = ${defaultVal}`); + constructorParams.push(`signature_type: Optional[str] = ${defaultVal}`); superArgs.push('signature_type=signature_type'); } constructorParams.push('base_url: Optional[str] = None'); @@ -204,7 +204,7 @@ function generateClass(exchange) { indent4('def __init__('), indent8('self,'), ...constructorParams.map(p => indent8(`${p},`)), - indent4('):'), + indent4(') -> None:'), indent8('"""'), indent8(`Initialize ${className} client.`), '', diff --git a/sdks/python/pmxt/__init__.py b/sdks/python/pmxt/__init__.py index deb28e39..24e53837 100644 --- a/sdks/python/pmxt/__init__.py +++ b/sdks/python/pmxt/__init__.py @@ -111,7 +111,7 @@ class _ServerNamespace: __slots__ = ("_manager",) - def __init__(self, manager: ServerManager): + def __init__(self, manager: ServerManager) -> None: self._manager = manager def status(self) -> Dict[str, Any]: diff --git a/sdks/python/pmxt/_exchanges.py b/sdks/python/pmxt/_exchanges.py index 2854a8d2..ac27bf3c 100644 --- a/sdks/python/pmxt/_exchanges.py +++ b/sdks/python/pmxt/_exchanges.py @@ -17,11 +17,11 @@ def __init__( passphrase: Optional[str] = None, private_key: Optional[str] = None, proxy_address: Optional[str] = None, - signature_type: Optional[Any] = "gnosis-safe", + signature_type: Optional[str] = "gnosis-safe", base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Polymarket client. @@ -76,7 +76,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Limitless client. @@ -120,7 +120,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Kalshi client. @@ -151,7 +151,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize KalshiDemo client. @@ -184,7 +184,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Probable client. @@ -227,7 +227,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Baozi client. @@ -256,7 +256,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Myriad client. @@ -288,7 +288,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Opinion client. @@ -320,7 +320,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Metaculus client. @@ -349,7 +349,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Smarkets client. @@ -380,7 +380,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize PolymarketUS client. @@ -411,7 +411,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Hyperliquid client. @@ -442,7 +442,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize GeminiTitan client. @@ -478,7 +478,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize SuiBets client. @@ -503,7 +503,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Mock client. @@ -528,7 +528,7 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize Router client. @@ -547,5 +547,3 @@ def __init__( # Backwards-compatible aliases for exchange classes generated before underscore handling. Polymarket_us = PolymarketUS Suibets = SuiBets - -from .router import Router as Router diff --git a/sdks/python/pmxt/client.py b/sdks/python/pmxt/client.py index f7584c3f..5c4219c7 100644 --- a/sdks/python/pmxt/client.py +++ b/sdks/python/pmxt/client.py @@ -13,7 +13,7 @@ import uuid from abc import ABC from datetime import datetime -from typing import Callable, List, Optional, Dict, Any, Literal, Union +from typing import Callable, List, Optional, Dict, Any, Literal, Union, Type # Add generated client to path _GENERATED_PATH = os.path.join(os.path.dirname(__file__), "..", "generated") @@ -91,7 +91,7 @@ def _convert_params_to_camel(params: Dict[str, Any]) -> Dict[str, Any]: return {_snake_to_camel(k): v for k, v in params.items()} -def _auto_convert(cls, raw: Dict[str, Any], **overrides): +def _auto_convert(cls: Type[Any], raw: Dict[str, Any], **overrides: Any) -> Any: """Auto-map camelCase raw dict to snake_case dataclass fields. Iterates over the dataclass fields, looks up the camelCase key in ``raw``, @@ -295,9 +295,9 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, proxy_address: Optional[str] = None, - signature_type: Optional[Any] = None, + signature_type: Optional[str] = None, pmxt_api_key: Optional[str] = None, - ): + ) -> None: """ Initialize an exchange client. @@ -1802,7 +1802,7 @@ def _watch_via_ws( def _ws_required_error(self, method_name: str) -> PmxtError: return PmxtError(f"{method_name}() requires WebSocket transport — connection failed") - def _require_ws_transport(self, method_name: str): + def _require_ws_transport(self, method_name: str) -> "SidecarWsClient": ws = self._get_or_create_ws() if ws is None: raise self._ws_required_error(method_name) @@ -2008,7 +2008,7 @@ def watch_all_order_books( raise PmxtError("watch_all_order_books() requires hosted mode (set pmxt_api_key)") effective_venues = venues if venues is not None else self._default_watch_all_order_book_venues() - args: list = [effective_venues] if effective_venues else [] + args: List[Any] = [effective_venues] if effective_venues else [] data = self._watch_via_ws("watchAllOrderBooks", args) if data is not None: return FirehoseEvent( @@ -2101,11 +2101,11 @@ def watch_address( ... print(f"Trade: {snapshot.trades}") """ try: - args: list = [address] + args: List[Any] = [address] if types is not None: args.append(types) - body: dict = {"args": args} + body: Dict[str, Any] = {"args": args} creds = self._get_credentials_dict() if creds: body["credentials"] = creds @@ -2142,7 +2142,7 @@ def unwatch_address( None """ try: - body: dict = {"args": [address]} + body: Dict[str, Any] = {"args": [address]} creds = self._get_credentials_dict() if creds: body["credentials"] = creds diff --git a/sdks/python/pmxt/errors.py b/sdks/python/pmxt/errors.py index a0e38f8f..9683824d 100644 --- a/sdks/python/pmxt/errors.py +++ b/sdks/python/pmxt/errors.py @@ -13,7 +13,7 @@ class PmxtError(Exception): """Base error class for all pmxt errors.""" - def __init__(self, message: str, code: str = "UNKNOWN_ERROR", retryable: bool = False, exchange: str | None = None): + def __init__(self, message: str, code: str = "UNKNOWN_ERROR", retryable: bool = False, exchange: str | None = None) -> None: super().__init__(message) self.message = message self.code = code @@ -86,7 +86,7 @@ def __init__(self, identifier: str, exchange: str | None = None): class RateLimitExceeded(PmxtError): """429 Too Many Requests - Rate limit exceeded.""" - def __init__(self, message: str, retry_after: float | None = None, **kwargs): + def __init__(self, message: str, retry_after: float | None = None, **kwargs) -> None: super().__init__(message, **kwargs) self.retry_after = retry_after @@ -104,7 +104,7 @@ class InsufficientFunds(PmxtError): class ValidationError(PmxtError): """400 Bad Request - Input validation failed.""" - def __init__(self, message: str, field: str | None = None, **kwargs): + def __init__(self, message: str, field: str | None = None, **kwargs) -> None: super().__init__(message, **kwargs) self.field = field diff --git a/sdks/python/pmxt/router.py b/sdks/python/pmxt/router.py index 21142fb6..8080538f 100644 --- a/sdks/python/pmxt/router.py +++ b/sdks/python/pmxt/router.py @@ -25,7 +25,7 @@ from pmxt_internal.exceptions import ApiException -def _parse_market(raw: Any) -> UnifiedMarket: +def _parse_market(raw: Any) -> Any: """Best-effort parse of a raw market dict into UnifiedMarket.""" if isinstance(raw, UnifiedMarket): return raw @@ -34,7 +34,7 @@ def _parse_market(raw: Any) -> UnifiedMarket: return raw -def _parse_event(raw: Any) -> UnifiedEvent: +def _parse_event(raw: Any) -> Any: """Best-effort parse of a raw event dict into UnifiedEvent.""" if isinstance(raw, UnifiedEvent): return raw @@ -124,7 +124,7 @@ def __init__( pmxt_api_key: Optional[str] = None, base_url: Optional[str] = None, auto_start_server: bool = False, - ): + ) -> None: """ Initialize the Router. @@ -306,7 +306,7 @@ def fetch_event_matches( results.append(EventMatchResult(event=event, market_matches=market_matches)) return results - def _get_catalog_path(self, path: str, params: Dict[str, Any]) -> Any: + def _get_catalog_path(self, path: str, params: Dict[str, Any]) -> Dict[str, Any]: """GET a hosted catalog /v0 path and return its raw JSON body.""" qs = self._build_sidecar_query_string(params) url = f"{self._resolve_sidecar_host()}{path}{'?' + qs if qs else ''}" diff --git a/sdks/python/pmxt/server_manager.py b/sdks/python/pmxt/server_manager.py index 0bb96d8a..38ab3bec 100644 --- a/sdks/python/pmxt/server_manager.py +++ b/sdks/python/pmxt/server_manager.py @@ -53,7 +53,7 @@ class ServerManager: # must share the same critical section. _ensure_lock = threading.Lock() - def __init__(self, base_url: str = "http://localhost:3847"): + def __init__(self, base_url: str = "http://localhost:3847") -> None: """ Initialize the server manager. diff --git a/sdks/python/pmxt/ws_client.py b/sdks/python/pmxt/ws_client.py index 51a705c2..30710f55 100644 --- a/sdks/python/pmxt/ws_client.py +++ b/sdks/python/pmxt/ws_client.py @@ -50,7 +50,7 @@ class _WsSubscription: __slots__ = ("request_id", "method", "symbols", "event") - def __init__(self, request_id: str, method: str, symbols: List[str]): + def __init__(self, request_id: str, method: str, symbols: List[str]) -> None: self.request_id = request_id self.method = method self.symbols = symbols @@ -66,7 +66,7 @@ class SidecarWsClient: may invoke subscribe/receive from any thread. """ - def __init__(self, host: str, access_token: Optional[str] = None, api_key: Optional[str] = None): + def __init__(self, host: str, access_token: Optional[str] = None, api_key: Optional[str] = None) -> None: self._host = host self._access_token = access_token self._api_key = api_key