pmxt icon indicating copy to clipboard operation
pmxt copied to clipboard

Python SDK exposes `watch_prices`, `watch_user_positions`, `watch_user_transactions` on base `Exchange` class — these methods only exist on `LimitlessExchange` in core

Open realfishsam opened this issue 6 months ago • 6 comments

Gap

In core, watchPrices, watchUserPositions, and watchUserTransactions are implemented exclusively on LimitlessExchange. The Python SDK incorrectly adds all three methods to the base Exchange class, meaning every exchange subclass (Kalshi, Polymarket, Myriad, etc.) inherits them. Calling these methods on any non-Limitless exchange via the Python SDK will produce a runtime error because the sidecar will attempt to call a method that doesn't exist on those exchange instances.

Core

core/src/exchanges/limitless/index.ts:495 — watchPrices exists ONLY on LimitlessExchange core/src/exchanges/limitless/index.ts:506 — watchUserPositions exists ONLY on LimitlessExchange core/src/exchanges/limitless/index.ts:517 — watchUserTransactions exists ONLY on LimitlessExchange

No other exchange class (KalshiExchange, PolymarketExchange, etc.) implements these methods. They are not on PredictionMarketExchange (base class).

TypeScript SDK

Missing entirely — tracked in issue #841.

Python SDK

sdks/python/pmxt/client.py:2180

def watch_prices(self, market_address: str, callback=None) -> Dict[str, Any]:
    ...  # on Exchange base class — inherited by ALL subclasses

sdks/python/pmxt/client.py:2216

def watch_user_positions(self, callback=None) -> List[Position]:
    ...  # on Exchange base class

sdks/python/pmxt/client.py:2253

def watch_user_transactions(self, callback=None) -> Dict[str, Any]:
    ...  # on Exchange base class

All three methods are defined on Exchange (the abstract base) rather than on the Limitless subclass. Every exchange inherits them. Calling Kalshi().watch_prices(...) will route to the sidecar which calls kalshi.watchPrices(...) — a method that doesn't exist — resulting in a runtime error with no static warning.

Evidence

watchPrices, watchUserPositions, watchUserTransactions appear at limitless/index.ts:495,506,517 and nowhere else in any other exchange's index.ts. The base class BaseExchange.ts does not define them. The Python SDK adds them to the base Exchange class at client.py:2180,2216,2253 — confirmed by searching for these method names.

Impact

  • Kalshi().watch_prices(...), Polymarket().watch_user_positions(...), etc. appear valid to static analysis and IDEs but fail at runtime.
  • These methods should be on a Limitless-specific class or guarded with a capability check.
  • Users writing generic code that iterates exchange instances may unknowingly call these on unsupported exchanges.
  • No type-level signal distinguishes Limitless from other exchanges for these capabilities.

Found by automated Core-to-SDK surface coverage audit

realfishsam avatar Jun 03 '26 16:06 realfishsam

Triage: removed P1: high because this is a dead-code issue (SDK methods that have no working core backing). Per labeling guidelines, "Dead SDK method with no core backing → P2: medium + type: dead-code + maintenance". Added P2: medium instead.


Generated by Claude Code

realfishsam avatar Jun 16 '26 21:06 realfishsam

Additional context from duplicate #1303: TypeScript SDK location is sdks/typescript/pmxt/client.ts:3164–3237 where watchPrices (line 3176), watchUserPositions, and watchUserTransactions are scoped to the Limitless subclass. Python callers on non-Limitless exchanges can invoke these methods without a type error, but will get a runtime error from the sidecar when it tries to dispatch to a non-existent method on those exchange instances.


Generated by Claude Code

realfishsam avatar Jun 24 '26 21:06 realfishsam

Additional context from duplicate #1368 (filed 2026-06-28):

Updated TypeScript SDK locations (file has grown since original filing):

  • watch_prices / watchPrices → client.ts line 3171 on class Limitless extends Exchange
  • watch_user_positions / watchUserPositions → client.ts line 3196 on class Limitless extends Exchange
  • watch_user_transactions / watchUserTransactions → client.ts line 3218 on class Limitless extends Exchange

Updated Python SDK locations (file has grown since original filing at lines 2180, 2216, 2253):

  • watch_prices → client.py line 2779 on base Exchange class
  • watch_user_positions → client.py line 2815 on base Exchange class
  • watch_user_transactions → client.py line 2852 on base Exchange class

The Python Limitless subclass in _exchanges.py (lines 75–124) still does not override or redeclare these methods — it inherits them from the base class.


Generated by Claude Code

realfishsam avatar Jun 28 '26 21:06 realfishsam

Additional context from duplicate #1379 (a later re-filing of this same finding):

  • Confirms the asymmetry plays out differently per language: in Python, calling e.g. Kalshi().watch_prices(...) compiles and fails only at runtime via a sidecar error. In TypeScript, the equivalent polymarket.watchPrices(...) is caught at compile time (Property 'watchPrices' does not exist on type 'Polymarket') since these methods are correctly scoped to the Limitless subclass there — so the bug is specifically that Python's base-class placement loses the compile-time safety TypeScript already has.

Generated by Claude Code

realfishsam avatar Jun 30 '26 21:06 realfishsam

Additional context from duplicate #1925 (filed under sdk-drift, comparing against the TypeScript SDK rather than core directly, but describing the identical Python-side defect — these three methods are still defined directly on the Exchange base class with no venue gating):

  • sdk/python/pmxt/client.py: watch_prices (line 2887), watch_user_positions (line 2923), watch_user_transactions (line 2960) — all defined on class Exchange(ABC) (line 309), no exchange_name/venue check in any of the three method bodies.
  • sdks/python/pmxt/_exchanges.py's Limitless class (lines 76-128) adds nothing extra; it simply inherits these from the base class like every other venue, confirming this is still unresolved.
  • Confirms the TypeScript SDK's Limitless subclass (sdks/typescript/pmxt/client.ts:3363) correctly scopes watchPrices/watchUserPositions/watchUserTransactions to itself only (lines 3375, 3399, 3422) — matching core's intent that only LimitlessExchange should expose these.

Closing #1925 as a duplicate of this issue.


Generated by Claude Code

realfishsam avatar Aug 06 '26 21:08 realfishsam

Additional context from duplicate #2103: confirmed that none of the other 15 non-Limitless venue subclasses in TypeScript (Polymarket, Kalshi, KalshiDemo, Myriad, Probable, Baozi, Opinion, Metaculus, Smarkets, PolymarketUS, GeminiTitan, Hyperliquid, SuiBets, Rain, Hunch, Mock) declare watchPrices/watchUserPositions/watchUserTransactions — only Limitless does (sdks/typescript/pmxt/client.ts:3375,3399,3422), while Python's base Exchange class defines all three at client.py:2887,2923,2960 and inherits them onto every venue. This also means the older issues #165/#166/#167 ("Python has watch_prices/watch_user_positions/watch_user_transactions missing from TypeScript") are stale — TypeScript does have these methods today, just correctly gated to the Limitless venue only, whereas Python has the opposite problem of no gating at all.


Generated by Claude Code

realfishsam avatar Sep 06 '26 21:09 realfishsam