Skip to main content

Order Book

Returns the CLOB L2 order book snapshot for a market’s primary token, keyed by condition id. The same OrderBookSnapshot payload is also available keyed by token id via GET /v1/clob/book/{token_id} or GET /v1/book?token_id=... — see the Order Book Lookup Recipe on the Markets page for when to use each form.

Request


Response

In the example above the best bid is 0.64 — the LAST bids entry (bids[-1]) — and the best ask is 0.66 — the LAST asks entry (asks[-1]). The best level is at the tail on both sides, byte-identical to Polymarket’s live /book wire. For safety, read order-independently — see the warning below.

Understanding the Book

Recommended: read the inside market order-independently, not by index. Bids are sorted ascending (best/highest bid last, bids[-1]) and asks descending (best/lowest ask last, asks[-1]) — the best of each side is the last element, byte-identical to what Polymarket’s live CLOB /book returns on the wire. Rather than indexing a fixed position, compute the best bid as the max bid price and the best ask as the min ask price. Coerce the price to a number first — prices are JSON strings, and max(b["price"] for b in bids) compares them lexicographically, where "0.9" > "0.10" is True (wrong). Use max(float(b["price"]) for b in bids) / min(float(a["price"]) for a in asks) (or Decimal for exactness). This stays correct regardless of array order, matching the live clob.polymarket.com/book wire.
Book level ordering matches Polymarket’s live wire: levels are bids ascending (best = bids[-1]), asks descending (best = asks[-1]) — best at the tail on both sides, byte-identical to the real clob.polymarket.com/book wire. Read the inside market with the order-independent max/min reads above rather than hard-coding bids[0] / asks[0], so your integration survives any future wire-format change.

Liquidity Assessment

Check the book before large orders. If your order size exceeds the top-of-book liquidity, you’ll walk through multiple price levels and experience slippage. Use slippage protection to guard against this.

Next Steps