Get Polymarket odds history in Python

A prediction market price is an odds quote, and Polymarket serves it live only: once a market moves on, its past prices are gone from the platform's API. This guide pulls the historical record instead, three layers of it, with the Marketlens SDK (pip install marketlens): the price line as candles, the full order book behind any price, and the resolved outcome to score odds against.

Find the market

Everything hangs off a market ID. Recurring markets are easiest to reach through their series slug, standalone events through the events endpoint, and anything through full text search:

python
from marketlens import MarketLens client = MarketLens() # by question text for market in client.markets.list(q="fed rate cut", take=5): print(market.id, market.question, market.status) # by series slug (recurring markets) [market] = client.markets.list( series_id="btc-up-or-down-5m", status="resolved", take=1, ) # by event (standalone: elections, geopolitics) [event] = client.events.list(q="presidential election winner 2028", take=1) markets = client.events.markets(event.id, take=10).to_list()

The catalog of what exists, per series market counts and coverage dates, is browsable on /data, with standalone events listed separately.

The price line: candles

Candles are the compact form of odds history: OHLC buckets from 1 second to 1 day, with volume and trade counts. A tight window and a sensible resolution keep row usage low, since every returned row counts against the daily allowance:

python
candles = client.markets.candles( market.id, resolution="1m", after="2026-08-10T00:00:00Z", before="2026-08-10T06:00:00Z", ) df = candles.to_dataframe() print(df[["open_time", "open", "high", "low", "close", "volume"]])

The book behind the price

A price without depth hides most of the story. The order book endpoints return the full L2 book as it stood at any past moment, or replay it over a window:

python
# the full book at one past moment book = client.orderbook.get(market.id, at="2026-08-10T03:00:00Z") print(book.midpoint, book.spread, book.bid_depth, book.ask_depth) # or replayed tick by tick over a window for market, book in client.orderbook.walk( market.id, after="2026-08-10T02:00:00Z", before="2026-08-10T03:00:00Z", ): print(book.as_of, book.best_bid, book.best_ask)

Most markets reconstruct exactly at every millisecond from the recorded delta chain; the longest dated event books, like the 2028 election legs, yield full depth snapshots at regular intervals. The mechanics are covered in the order book guide.

Odds against outcomes

Every resolved market stores its winning outcome, which turns odds history into scored data: what the market believed, next to what happened. Closing odds against results, across any series:

python
for market in client.markets.list( series_id="mlb", status="resolved", take=20, ): closing = client.orderbook.get(market.id, at=market.close_time) print(market.question, closing.midpoint, market.winning_outcome)

From here the natural next step is systematic: the execution backtesting guide turns the same recorded books into a strategy testbed, and the resolution dataset is described on resolution history.

Common questions

How do I get historical odds from Polymarket?

Polymarket's own API serves live prices only, so historical odds come from a service that has been recording them. With the Marketlens SDK, find the market by question, series, or event, then pull its candles for the price line, its order book at any past timestamp for the depth behind the price, and its winning outcome once it resolves.

Can I get Polymarket price history for free?

Yes. The Marketlens free tier includes 5 million data rows per day with full API and full archive access, which covers substantial candle and order book pulls. No card is required to sign up.

What resolution does the price history have?

Candles come in buckets from 1 second up to 1 day. Underneath them, most markets carry every individual price change with a millisecond timestamp, and the longest dated event books carry full depth snapshots at regular intervals.

Does this work for standalone events like elections?

Yes. Standalone events that sustain real trading volume are collected since August 2026, the 2028 presidential race included. Their books are captured at full depth, and the order book endpoints work the same way; start from the events endpoint rather than a series slug.

Try it

Pull any market's odds history in two minutes

The free tier includes 5M rows per day with full API and full archive access, no card required.

bash
$ pip install marketlens