Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/api-doc-config.generated.json
Original file line number Diff line number Diff line change
@@ -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). */",
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/generate-python-exchanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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.`),
'',
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/pmxt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
36 changes: 17 additions & 19 deletions sdks/python/pmxt/_exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand All @@ -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.

Expand All @@ -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.

Expand All @@ -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
18 changes: 9 additions & 9 deletions sdks/python/pmxt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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``,
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions sdks/python/pmxt/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions sdks/python/pmxt/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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 ''}"
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/pmxt/server_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions sdks/python/pmxt/ws_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading