Skip to content

Router.fetchOrderBook silently discards limit, since, and until despite both SDKs declaring and forwarding them #2199

Description

@realfishsam

Gap

Both SDKs' Router.fetchOrderBook wrappers declare and forward a limit parameter (depth-limiting) and a FetchOrderBookParams/params object whose type declares since/until (historical snapshot lookup). Core's Router.fetchOrderBook accepts limit in its signature but never reads it, and never forwards the caller's params object downstream at all — it rebuilds a fresh { side } object for every venue call. Depth-limiting and historical order-book snapshots are unreachable through the Router even though both SDKs type and document them.

Core

core/src/router/Router.ts:379

async fetchOrderBook(outcomeId: string, limit?: number, params?: Record<string, any>): Promise<OrderBook>

limit appears only in the signature (lines 379–444) and is never referenced in the method body. Only params?.side is read (line 387); downstream calls hardcode the rest:

  • line 411: exchange.fetchOrderBook(outcome.outcomeId, undefined, { side: resolvedSide })
  • line 422: exchange.fetchOrderBook(outcomeId, undefined, { side: resolvedSide })
  • line 443: return mergeOrderBooks(...) — no truncation to limit.

TypeScript SDK

sdks/typescript/pmxt/router.ts:649 — override documents @param limit - Optional maximum number of price levels per side and calls super.fetchOrderBook(outcomeId, limit, params); base at client.ts:1312 pushes limit and params through to core, where they're dropped. Line 655 (Array.isArray(book) ? book[0] : book) is also dead code since core's Router can never return an array.

Python SDK

sdks/python/pmxt/router.py:665 — same docstring claim, calls super().fetch_order_book(outcome_id, limit=limit, params=params); base at client.py:1589-1594 forwards both. FetchOrderBookParams declaring since/until: models.py:830.

Evidence

Core's Router.fetchOrderBook (Router.ts:379-444) never references its own limit parameter and rebuilds params as { side: resolvedSide } before every downstream exchange.fetchOrderBook call, discarding anything else the caller passed (including since/until, which FetchOrderBookParams declares in both SDKs' type definitions).

Impact

A Router user cannot cap merged order-book depth (every level from every matched venue is always returned, with no way to request fewer) and cannot request a historical/point-in-time consolidated book, despite both capabilities being typed, documented (@param limit), and transmitted by both SDKs.


Found by automated Core-to-SDK surface coverage audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-sdk-gapCore engine capabilities not exposed in SDKs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions