← All posts

How to Get Polymarket Historical Order Book Data: API, Bulk Datasets, or Scraping

Three ways to get historical Polymarket order book and trade data — scraping the CLOB yourself, the polyReplay REST API, and bulk Parquet downloads — with the trade-offs of each.

By polyReplay team

Quick answer: there are three ways to get historical Polymarket order book data — (1) record the live CLOB feed yourself, (2) query a historical REST API, or (3) download pre-packaged bulk datasets. Polymarket's own API only serves the live book, so for true history you either capture it going forward yourself or use an archive like polyReplay, which has recorded every tick of the crypto Up-or-Down markets since launch and serves it as a REST API and as bulk Parquet files.

Why Polymarket's own API isn't enough for history

Polymarket runs a central limit order book (CLOB). Its public API is excellent for what's happening right now — the live book, recent trades, current prices — but it is not designed as a research archive:

  • There is no endpoint that returns the full order book as it looked at an arbitrary past timestamp.
  • Resolved markets fall out of the active set, and there is no bulk export of their full history.
  • Nothing is joined to the underlying spot price, which is what you actually need to study whether an Up-or-Down market was "right".

So if you want history, you have to get it some other way.

Option 1 — Scrape the CLOB yourself

Connect to Polymarket's WebSocket, subscribe to the markets you care about, and write every book update and trade to disk.

| | | |---|---| | Cost | Free (plus your own server) | | Coverage | Only from the moment you start recording — you cannot recover the past | | Effort | High — reconnection logic, gap detection, storage, one stream per market | | Best for | Teams that decided early and run their own infra |

The fatal limitation: you can't scrape data that already happened. If a market resolved last month and you weren't recording it, that history is gone for you. Tick-accurate capture across thousands of simultaneous markets also turns out to be a real engineering project, not a weekend script.

Option 2 — A historical REST API

Query a third-party archive over HTTP. polyReplay exposes resolved markets, top-of-book time series, and trade prints:

# List resolved BTC Up-or-Down markets
curl -H "Authorization: Bearer $POLYREPLAY_API_KEY" \
  "https://polyreplay.dev/api/v1/markets?token=BTC&timeframe=5m&limit=100"

# Top-of-book time series for one market
curl -H "Authorization: Bearer $POLYREPLAY_API_KEY" \
  "https://polyreplay.dev/api/v1/markets/<condition_id>/book"

| | | |---|---| | Cost | Free tier (BTC, last 7 days); Pro $19.99/mo for ETH + full archive | | Coverage | Full archive since launch, joined with Binance spot | | Effort | Low — it's just HTTP | | Best for | Dashboards, ad-hoc queries, pulling a few markets |

Option 3 — Bulk Parquet datasets

For backtesting you usually don't want to page through an API millions of rows at a time — you want files. polyReplay packages one Parquet file per market (named by its slug), containing tick-by-tick trades, top-of-book, and full 25-level (L25) depth together — captured at sub-150ms intervals with 100+ days of history — joined with second-resolution Binance spot:

import pandas as pd
df = pd.read_parquet("btc-updown-5m-1717804800.parquet")
print(df.columns)  # ts, best_bid, best_ask, depth..., trade_price, spot_price, ...

| | | |---|---| | Cost | Included; unlimited downloads on Pro | | Coverage | Every resolved market, full L25 depth | | Effort | Lowest — download and read_parquet | | Best for | Backtesting, ML, microstructure research |

Which should you use?

  • Just exploring? Use the free REST API tier.
  • Building a dashboard or bot? REST API for live-ish queries.
  • Backtesting or training models? Bulk Parquet — no rate limits, no gaps, loads straight into pandas/Polars.
  • Need data nobody archived and you have infra? Roll your own capture — but only for data going forward.

The honest summary: scraping is free but can only ever capture the future, and Polymarket's own API doesn't serve history at all. If you need the past, you need an archive. That's exactly what polyReplay is — start on the free tier or read the docs.

Frequently asked questions

Does Polymarket have a historical data API?

Polymarket's own CLOB API exposes the live order book and recent trades, but it does not provide a queryable historical archive of past order books, resolved-market outcomes, or bulk downloads. To get history you either record the live feed yourself over time or use a third-party archive such as polyReplay, which has been capturing every tick since launch.

Can I scrape Polymarket order book data for free?

Yes — you can connect to Polymarket's public CLOB WebSocket and REST endpoints and record the book yourself at no cost. The catch is that you only capture data from the moment you start recording forward; you cannot retroactively scrape history that has already passed, and maintaining tick-accurate capture across thousands of markets is non-trivial.

What is the fastest way to get Polymarket history for backtesting?

Bulk Parquet downloads. polyReplay packages each resolved market as a single Parquet file containing trades, top-of-book, and 25-level depth, joined with Binance spot. You download the files you need and load them straight into pandas or Polars — no rate limits, no scraping, no gaps.