The orderbooks endpoints provide access to historical bid/ask data collected from the Polymarket WebSocket feed since January 1, 2026. Each snapshot contains the full orderbook depth at a specific timestamp.Documentation Index
Fetch the complete documentation index at: https://docs.poly-data.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Data Structure
Each orderbook snapshot contains bid and ask arrays as[price, size] tuples:
| Field | Type | Description |
|---|---|---|
ts | integer | Unix timestamp in milliseconds |
asset_id | string | Token ID for the outcome |
market_id | string | Market ID |
outcome_index | integer | Outcome position (0 = first outcome, typically “Yes”) |
bids | array | Buy orders as [price, size] tuples, sorted by price descending |
asks | array | Sell orders as [price, size] tuples, sorted by price ascending |
Query Orderbooks
GET
Query orderbook snapshots with filters. Results are ordered by timestamp descending (most recent first).
At least one of
market_id or asset_id is required.Query Parameters
Filter by market ID.
Filter by asset/token ID.
Filter by outcome. Accepts
yes, no, 0, or 1.Start timestamp in milliseconds (inclusive).
End timestamp in milliseconds (inclusive).
Results per page (1–1000).
Timestamp cursor for pagination. Returns rows with
ts < cursor_ts.Examples
Get orderbook history for a market:Get Latest Orderbook
GET
Get the most recent orderbook snapshot for a market or asset.
At least one filter parameter (
market_id, asset_id, or outcome) is required.Query Parameters
Filter by market ID.
Filter by asset/token ID.
Filter by outcome. Accepts
yes, no, 0, or 1.Examples
Get latest orderbook for a market:This endpoint has a 500ms cache TTL for near real-time data access.
Get Orderbooks by Market ID
GET
Convenience endpoint to get orderbook snapshots for a specific market. Results are ordered by timestamp descending.
Path Parameters
Market ID.
Query Parameters
Filter by outcome. Accepts
yes, no, 0, or 1.Start timestamp in milliseconds (inclusive).
End timestamp in milliseconds (inclusive).
Results per page (1–1000).
Timestamp cursor for pagination. Returns rows with
ts < cursor_ts.Example
Pagination Example
For large historical queries, use cursor-based pagination. Start with a very highcursor_ts value and follow the next cursor:
Common Use Cases
Backtesting
Fetch historical orderbooks within a time range to simulate trading strategies.
Spread Analysis
Calculate bid-ask spreads over time to analyze market liquidity.
Event Studies
Study how orderbooks change around major news events.
Market Making
Analyze historical depth to calibrate market making parameters.