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_ms is the file write time.

  • The timestamp field inside the JSON is the event time from the data source.

Event Types (event_type)

Each message contains the field:

  • event_type β€” string identifier of the event type.

Supported event types:

  • book

  • price_change

  • last_trade_price

  • best_bid_ask

  • new_market

  • market_resolved

  • tick_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

The message contains the complete order book state for a single asset_id.

  • event_type β€” "book".

  • market β€” market identifier (hex string starting with 0x).

  • 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 this asset_id.

Structure of bids / asks Elements

Each 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

The 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

  • asset_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

Message 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

Message 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 between best_ask and best_bid.

  • timestamp β€” event time in Unix epoch milliseconds.


5. new_market β€” New Market

Message 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

Message 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_id of the winning outcome token.

  • timestamp β€” event time in Unix epoch milliseconds.


7. tick_size_change β€” Tick Size Update

Message 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