Skip to content

SDK drift: SubscriptionOption type missing from Python; watch_address uses untyped list[str] #467

@realfishsam

Description

@realfishsam

Drift

TypeScript exports a SubscriptionOption union type constraining watch_address subscription categories to 'trades' | 'positions' | 'balances'. Python has no equivalent type and watch_address accepts a plain list[str], providing no type-safety or documentation of valid values.

TypeScript SDK

sdks/typescript/pmxt/models.ts, line 768:

// sdks/typescript/pmxt/models.ts line 768
export type SubscriptionOption = 'trades' | 'positions' | 'balances';

sdks/typescript/pmxt/client.ts, line 1728:

// sdks/typescript/pmxt/client.ts line 1728
async watchAddress(
    address: string,
    types?: SubscriptionOption[]
): Promise<SubscribedAddressSnapshot>

SubscriptionOption is also exported from sdks/typescript/index.ts via export type * from "./pmxt/models.js".

Python SDK

sdks/python/pmxt/client.py, line 2033 — untyped list[str]:

# sdks/python/pmxt/client.py line 2033
async def watch_address(
    self,
    address: str,
    types: list[str] = None,
) -> SubscribedAddressSnapshot:

No SubscriptionOption literal type exists anywhere in sdks/python/pmxt/models.py or sdks/python/pmxt/__init__.py.

Expected

Python should define a SubscriptionOption Literal type (or TypeAlias) equivalent to TypeScript's union:

SubscriptionOption = Literal['trades', 'positions', 'balances']

watch_address should use Optional[list[SubscriptionOption]] and SubscriptionOption should be exported from __init__.py and included in __all__.

Impact

Python callers can pass any string as a subscription type (e.g., "trade" instead of "trades") and receive no static or runtime error until the sidecar rejects the request. TypeScript callers get a compile-time error for the same mistake. Discoverability of valid values is also lost in Python.

Found by automated SDK cross-language drift audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    sdk-driftCross-language SDK consistency findings (TypeScript vs Python)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions