Skip to main content

What you’ll get

The cost of buying 1,000ofYesand1,000 of Yes and 1,000 of No in one market, filled level by level from the recorded order book: contracts bought, average and worst price, and how far that sits from the best ask. Run on a deep market and a thin one, it shows why a top-of-book price on a thin market says almost nothing. On 2026-09-17 a deep Bitcoin market filled $1,000 of No at 0.24¢ over the top; a thin college-football spread filled it 4.96¢ over.

Prerequisites

  • An API key in ROUTEUR_API_KEY
  • Python 3 with requests
  • A market whose book is recorded. Markets graded tradeable or deep, markets in a current lead, and markets of followed events are recorded at full depth; every other listed market is polled five levels per side.
1

Read the book

Both outcomes’ ladders, best first, with the top of book and the USD resting within 1, 2 and 5¢ of each side’s best bid.
Trimmed to the top and the first three levels, observed 2026-09-17 12:40 UTC:
The No asks are the Yes bids seen from the other side: 1,048 contracts bid at 76¢ for Yes are 1,048 contracts offered at 24¢ for No.
2

Walk the levels

Spend the budget up each ladder until it runs out, and compare the average price paid with the best ask.
Python
A deep market, observed 2026-09-17 12:48 UTC:
A thin one, observed 2026-09-17 12:52 UTC:
3

Compare

Both markets show a 1¢ spread. On the thin one, the best No ask is a hundredth of a contract: the quote is real and the market behind it is not. spread_usd alone would have graded them the same; liquidity, volume_24h_usd and the 5¢ depth did not.

Read the result

Pitfalls

  • A rest book has five levels per side. A 1,000walkononecanrunoutoflevels;thescriptsaysso("only1,000 walk on one can run out of levels; the script says so ("only X can be filled from the N recorded levels”). That is a limit of the recording, not the market.
  • Quantities can be fractional. Polymarket shares are, and Kalshi showed a 0.01 on 2026-09-17. Use Decimal, not int.
  • Fees are not in these numbers. Kalshi charges a taker fee per contract that depends on the price; Polymarket a rate on the notional. A lead’s depth.fees_usd estimates both; see Leads.
  • Books can be one-sided. A Polymarket book on 2026-09-17 carried Yes asks and No bids but no Yes bids, so top.yes_bid_usd was absent and both yes_depth_* were 0. Check for the field before subtracting.
  • The book is a recording. as_of says how old. For an order, read the venue directly; use this to decide whether an order is worth placing.
  • 404 book_not_found means no book is recorded for that market at that time. Market data still exists; the book does not.
  • Proof trail: a lead’s depth does this walk for both legs and subtracts fees.
  • Price chart: the top of the book over time from /book/history.
  • GET /v1/markets/{venue}/{id}/book?at=2026-09-16T14:30:00Z: the book as it stood at any moment in the last 90 days.
  • GET /v1/books/health: whether each venue’s feed is up, how many markets are recorded at full depth and how many are polled.
  • Stream consumer: the books topic pushes the top of book as it changes, at most once a second per market.