01.Why history is not simply an endpoint
The order book is current state, not an archive — the API tells you what is resting now, and once a level is consumed it is gone from that view. Trades that executed are recorded on-chain and so are recoverable, but reconstructing what the book looked like at a moment in the past means having captured it at the time. That distinction decides which strategies you can backtest.
- Executed trades are on-chain and recoverable after the fact.
- Historical order book depth is not, unless someone recorded it.
- A strategy that depends on past depth cannot be backtested from public history alone.
02.The four sources
They differ in effort, completeness and whether you can trust them to still be there next year.
- On-chain data: authoritative and complete for trades and settlements, but you do the reconstruction work.
- Subgraphs and indexers: on-chain events pre-indexed into a queryable API. Much less work, and you inherit their schema decisions.
- Third-party data providers: cleaned and ready, at a price, with a dependency you do not control.
- Your own recording: the only way to get order book snapshots, and only from the day you start.
03.Start recording before you need it
This is the advice people wish they had taken. Book snapshots, spreads and depth only exist if something captured them at the time, and no amount of effort recovers them later. If there is any chance you will want that data, a small process writing periodic snapshots costs almost nothing and is irreplaceable once a few months have accumulated.
- Snapshot the book on a schedule for markets you care about.
- Record the full raw payload, not just the fields you currently use.
- Timestamp everything consistently, ideally in UTC.
04.Survivorship bias will ruin your backtest
The specific trap in prediction market data is that it is easiest to gather history for markets that resolved cleanly and had volume. Markets that were cancelled, disputed, or died quietly are exactly the ones your dataset will be missing, and they are exactly the ones that would have hurt a live strategy. A backtest built only on well-behaved markets will look far better than reality.
- Include cancelled, disputed and low-volume markets or know that you have not.
- Record resolution outcomes as well as prices — disputes matter.
- A backtest on clean markets only is a measure of the dataset, not the strategy.