Skip to main content

Order Book

GET /v1/markets/{condition_id}/book
Returns the CLOB L2 order book snapshot for a market’s primary token.

Request

curl -H "X-API-Key: $API_KEY" \
  "https://api.polysimulator.com/v1/markets/0x1a2b3c/book?outcome=Yes&depth=5"
ParameterTypeDefaultDescription
outcomestringFilter by outcome label (e.g. Yes, No)
depthint10Number of price levels per side (max 50)

Response

{
  "token_id": "71321...",
  "bids": [
    {"price": "0.64", "size": "500.0"},
    {"price": "0.63", "size": "1200.0"},
    {"price": "0.62", "size": "3000.0"}
  ],
  "asks": [
    {"price": "0.66", "size": "400.0"},
    {"price": "0.67", "size": "800.0"},
    {"price": "0.68", "size": "2500.0"}
  ],
  "mid": "0.65",
  "spread": "0.02",
  "timestamp": "2026-02-06T12:00:45Z"
}

Understanding the Book

FieldDescription
bidsBuy orders sorted by price (highest first)
asksSell orders sorted by price (lowest first)
midAverage of best bid and best ask
spreadDifference between best ask and best bid
pricePrice level
sizeTotal shares available at that price

Liquidity Assessment

from decimal import Decimal

book = api.get_order_book("0x1a2b3c...")

# Calculate total bid liquidity
bid_liquidity = sum(
    Decimal(level["size"]) for level in book["bids"]
)

# Calculate total ask liquidity
ask_liquidity = sum(
    Decimal(level["size"]) for level in book["asks"]
)

spread = Decimal(book["spread"])

print(f"Spread: {spread}")
print(f"Bid depth: {bid_liquidity} shares")
print(f"Ask depth: {ask_liquidity} shares")
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