Order Book (CLOB) Data Storage Format
Polymarket order book data are stored in text files.
The storage format is TSV (tab-separated values): one line = one event.
Each line in a file consists of two parts separated by a tab character:
<capture_timestamp_ms> <json_payload>
capture_timestamp_msβ time when the event was written to the file, in Unix epoch milliseconds (UTC).json_payloadβ a JSON object or JSON array containing the event data.
Important:
capture_timestamp_msis the file write time.The
timestampfield inside the JSON is the event time from the data source.
Event Types (event_type)
event_type)Each message contains the field:
event_typeβ string identifier of the event type.
Supported event types:
bookprice_changelast_trade_pricebest_bid_asknew_marketmarket_resolvedtick_size_change
Data Representation
All identifiers (
market,asset_id,id) are stored as strings.All numeric price and volume values (
price,size,best_bid,best_ask,spread) are stored as strings in decimal representation.Timestamps inside JSON are Unix epoch milliseconds (UTC).
Each line in the file is self-contained and can be processed independently.
1. book β Full Order Book Snapshot
book β Full Order Book SnapshotThe message contains the complete order book state for a single asset_id.
event_typeβ"book".marketβ market identifier (hex string starting with0x).asset_idβ outcome token identifier (string).timestampβ snapshot generation time in Unix epoch milliseconds.hashβ snapshot version identifier.bidsβ array of bid levels.asksβ array of ask levels.last_trade_priceβ last traded price for thisasset_id.
Structure of bids / asks Elements
bids / asks ElementsEach level is an object with:
priceβ level price (decimal string).sizeβ total size at the level (decimal string).
bids β buy orders (from best to worst).
asks β sell orders (from best to worst).
2. price_change β Order Book Level Updates
price_change β Order Book Level UpdatesThe message contains a set of updates for a single market.
event_typeβ"price_change".marketβ market identifier.timestampβ event time in Unix epoch milliseconds.price_changesβ array of changes.
Structure of price_changes Elements
price_changes Elementsasset_idβ outcome token to which the change applies.priceβ level price (string).sizeβ size change at this level (string).sideβ side of the book:"BUY"β bid side,"SELL"β ask side.
hashβ change identifier.best_bidβ current best bid after the update.best_askβ current best ask after the update.
3. last_trade_price β Last Trade Price
last_trade_price β Last Trade PriceMessage updating the last traded price.
event_typeβ"last_trade_price".marketβ market identifier.asset_idβ outcome token.priceβ last trade price (string).timestampβ event time in Unix epoch milliseconds.
4. best_bid_ask β Best Prices and Spread
best_bid_ask β Best Prices and SpreadMessage containing the current best prices.
event_typeβ"best_bid_ask".marketβ market identifier.asset_idβ outcome token.best_bidβ best bid price (string).best_askβ best ask price (string).spreadβ difference betweenbest_askandbest_bid.timestampβ event time in Unix epoch milliseconds.
5. new_market β New Market
new_market β New MarketMessage announcing the creation of a new market.
event_typeβ"new_market".idβ internal market identifier.questionβ market title/question.marketβ market identifier (0x...).slugβ string market identifier.descriptionβ market rules/description.asset_idsβ array of outcome tokens (strings).outcomesβ array of outcome names.timestampβ event time in Unix epoch milliseconds.tagsβ array of tags (may be empty).event_messageβ nested object with extended market information.
6. market_resolved β Market Resolved
market_resolved β Market ResolvedMessage indicating market completion and the winning outcome.
event_typeβ"market_resolved".idβ market identifier.questionβ market title.marketβ market identifier (0x...).slugβ market slug.winning_outcomeβ name of the winning outcome.winning_asset_idβasset_idof the winning outcome token.timestampβ event time in Unix epoch milliseconds.
7. tick_size_change β Tick Size Update
tick_size_change β Tick Size UpdateMessage indicating a change in the minimum price tick size for an asset_id.
event_typeβ"tick_size_change".marketβ market identifier.asset_idβ outcome token.old_tick_sizeβ previous tick size.new_tick_sizeβ new tick size.timestampβ event time in Unix epoch milliseconds.
Last updated