Skip to content

SDK drift: TypeScript gates trading methods on isHostedTradingMode() (venue allowlist); Python gates on self.is_hosted (any hosted URL) #1012

@realfishsam

Description

@realfishsam

What

The condition that controls access to the hosted trading path differs across SDKs.

TypeScript (sdks/typescript/pmxt/client.ts):

  • createOrder, buildOrder, cancelOrder, fetchClosedOrders, fetchAllOrders check this.isHostedTradingMode().
  • isHostedTradingMode() returns true only when BOTH pmxtApiKey is set AND this.exchangeName is in HOSTED_TRADING_VENUES = new Set(["polymarket", "opinion"]) (sdks/typescript/pmxt/hosted-routing.ts).
  • For any other hosted venue (e.g. Kalshi with pmxtApiKey), TypeScript throws: "Trade execution is not available through the hosted API".

Python (sdks/python/pmxt/client.py:3003, 3159, 3262):

  • create_order, build_order, submit_order check self.is_hostedTrue for ANY client constructed with pmxt_api_key, regardless of venue name.
  • There is no venue-allowlist guard; all venues enter the hosted trading code path.

Impact

A Python Kalshi(pmxt_api_key=...) client will attempt to route create_order through the hosted trading API. The equivalent TypeScript Kalshi(pmxtApiKey: ...) client will throw an explicit "not available" error before making any request. The Python path silently enters a code path that is likely to fail at the server level with a cryptic error.

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