Skip to content

feat: add fetchOrderBooks for multi-market order book retrieval#130

Open
psyberck wants to merge 11 commits into
pmxt-dev:mainfrom
psyberck:feat/fetch-multi-order-books
Open

feat: add fetchOrderBooks for multi-market order book retrieval#130
psyberck wants to merge 11 commits into
pmxt-dev:mainfrom
psyberck:feat/fetch-multi-order-books

Conversation

@psyberck
Copy link
Copy Markdown
Contributor

@psyberck psyberck commented May 11, 2026

Summary (Issue #126)

  • Adds new fetchOrderBooks(outcomeIds) API for batch order book retrieval, implemented for Polymarket and Kalshi
  • Adds Kalshi GetMarketOrderbooks implicit endpoint
  • Renames the ids parameter to outcomeIds across the API surface for consistency with existing unified types.
  • Add paramsSerializer so array query params are encoded correctly.

Files of note

  • core/src/BaseExchange.ts, core/src/exchanges/kalshi/{index,api,fetcher}.ts, core/src/exchanges/polymarket/{index,fetcher}.ts — new method + refactor
  • core/specs/kalshi/Kalshi.yaml, core/src/server/openapi.yaml, docs/api-reference/openapi.json — spec updates
  • sdks/{typescript,python}/... — client helper + regenerated reference docs

Side Effects

  • Rather than copying the entire openapi.yaml into Kalshi.yaml, only the GetMarketOrderbooks endpoint was added. Upgrading to Kalshi API v3.16.0 introduces extensive interface changes, which would require modifying a large number of existing function signatures.
  • The createImplicitMethod function signature was updated to accept parameters of type Record<string, any> | any[] for greater flexibility. A more robust approach exists, but implementing it would necessitate widespread changes across related function calls.
  • Aligned indentation and quote style in kalshi/index.ts with project conventions.

Testing

  • Ploymarket valid outcome Ids (Python)
Screenshot from 2026-05-11 02-00-46 - Ploymarket invalid outcome Ids (Python) Screenshot from 2026-05-11 01-59-48 - Ploymarket valid outcome Ids (TypeScript) Screenshot from 2026-05-11 02-12-03 - Kalshi valid outcome Ids (Python) Screenshot from 2026-05-11 02-53-43

@realfishsam
Copy link
Copy Markdown
Contributor

Awesome. Will merge asap.

For next time: please copy and paste the code input/output instead of using screenshots! Makes things easier on my end!

@psyberck
Copy link
Copy Markdown
Contributor Author

Awesome. Will merge asap.

For next time: please copy and paste the code input/output instead of using screenshots! Makes things easier on my end!

For sure, thanks for pointing out. I will leave my testing scripts in the PR as well in the future. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants