Skip to content

Python MarketFetchParams / EventFetchParams use snake_case keys but server expects camelCase #456

@realfishsam

Description

@realfishsam

Inconsistency

MarketFetchParams and EventFetchParams in the Python SDK define TypedDict keys in snake_case (market_id, outcome_id, event_id, search_in). If these dicts are passed to the HTTP server as-is, the server will receive snake_case keys where it expects camelCase (marketId, outcomeId, eventId, searchIn).

Current (PMXT)

sdks/python/pmxt/models.py lines 555–584:

class MarketFetchParams(TypedDict, total=False):
    query: str
    limit: int
    offset: int
    sort: Literal["volume", "liquidity", "newest"]
    status: Literal["active", "inactive", "closed", "all"]
    search_in: Literal["title", "description", "both"]  # ← snake_case
    slug: str
    market_id: str    # ← snake_case
    outcome_id: str   # ← snake_case
    event_id: str     # ← snake_case
    category: str
    tags: List[str]
    filter: MarketFilterCriteria

class EventFetchParams(TypedDict, total=False):
    query: str
    limit: int
    ...
    event_id: str     # ← snake_case
    search_in: Literal["title", "description", "both"]  # ← snake_case

The TypeScript SDK uses camelCase in its equivalent types (sdks/typescript/pmxt/models.ts), consistent with what the server expects.

Expected (CCXT convention)

CCXT's Python SDK translates parameter names to the correct casing before sending them. Python-idiomatic TypedDict keys are acceptable for the public API, but the client must convert market_id → marketId, search_in → searchIn, etc. before the HTTP request. Either the TypedDict keys should be camelCase (matching the wire format), or the client layer must perform the conversion explicitly.

Impact

Calls to fetchMarkets(market_id="abc") will silently send market_id to the server, which ignores it (expects marketId). The market-ID filter is silently a no-op. This is a data-loss bug, not merely a style issue.


Found by automated PMXT ↔ CCXT API consistency audit

Metadata

Metadata

Assignees

No one assigned

    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