Get Book By Token
Get the order book for a single token.
Public endpoint — no authentication required.
Mirrors Polymarket’s GET /book?token_id=... shape (market,
asset_id, timestamp, hash, tick_size, neg_risk,
last_trade_price, min_order_size from PR #1033 P1-1).
Level ordering is byte-identical to Polymarket’s LIVE /book
wire (verified against clob.polymarket.com/book 2026-06-10):
bids are ASCENDING by price (best/highest bid = bids[-1]) and
asks are DESCENDING by price (best/lowest ask = asks[-1]) —
the best level is at the TAIL on BOTH sides, exactly as PM’s live
CLOB returns it. Note this is the wire ordering; PM’s published
docs describe the opposite, but the live wire does not match the
docs and wire-parity is the contract here. mid and spread are
computed from the FULL book (true top-of-book), not from the
truncated slice — see _book_levels_and_summary.
RECOMMENDED — read order-independently: do NOT index a fixed
position. Compute best bid as max(float(b["price"]) for b in bids) and best ask as min(float(a["price"]) for a in asks).
This stays correct regardless of array order and survives any future
wire-format change on either side.
MIGRATION NOTE (2026-06-10): book level ordering changed to PM
live-wire parity. History (3 changes in 24h): pre-2026-05-19 bids
were ASCENDING (best = bids[-1]); the 2026-06-10 AM change flipped
to bids DESCENDING / asks ASCENDING (best = [0]) to match PM’s
docs; this change re-sorts to PM’s live wire — bids ASCENDING /
asks DESCENDING (best = [-1]). A bot that read bids[0] for the
best bid during the brief docs-aligned window now gets the WORST bid;
switch to the order-independent max/min reads above.
Query Parameters
CLOB outcome token ID
OPTIONAL trim: keep only the best N levels per side. Default (omitted) returns the FULL book — Polymarket's wire contract (PM has no depth param). Pre-2026-06-11 the default silently truncated to 10 levels (max 50), so ported depth/imbalance/queue-position logic computed on a sliver of the real book.
1 <= x <= 500Response
Successful Response
Polymarket-compat OrderBookSummary.
The PM-CLOB GET /book response carries metadata fields
(market, asset_id, hash, timestamp,
min_order_size, tick_size, neg_risk,
last_trade_price) that SDK consumers ported from Polymarket
clients depend on — particularly tick_size for client-side
price quantization and neg_risk for routing through the
correct contract. Pre-this-PR the response was a Polysimulator
minimum (token_id, bids, asks, spread, mid)
that would silently break PM-ported SDKs at parse time.
The legacy fields (spread, mid) are kept for back-compat
with existing Polysimulator SDK consumers who relied on them.
Polymarket's actual /book doesn't return either; they're
Polysimulator extensions and documented as such.