TradeLabs AILearn

Historical Data for Backtesting

Backtests are only as good as their data. Learn data types and sources, quality checks, corporate action adjustments and how to avoid survivorship traps.

Intermediate3 min readUpdated 3 Oct 2026
Markdown
Lesson 5 of 38

Every backtest depends on historical data, and flawed data produces flawed conclusions with complete confidence. Missing delisted stocks, unadjusted splits, wrong timestamps or a single bad price can turn a losing strategy into an apparent winner. Choosing the right data, understanding its limits and checking its quality are some of the least glamorous but most important steps in trading research.

Types of historical data#

TypeGranularityTypical useLesson
Daily bars (OHLCV)One bar per daySwing and position strategiesTick Data and OHLCV Data
Intraday bars1 minute to 1 hourDay trading strategiesTick Data and OHLCV Data
Tick and trade dataEvery tradeExecution research, scalpingTick Data and OHLCV Data
Order book dataEvery quote changeMarket making, microstructureOrder Book Feeds: Snapshots and Incremental Updates
Fundamental dataQuarterly and annualValue and quality strategiesFundamental Data
Alternative dataVariesSpecialised signalsAlternative Data Explained
Corporate actionsEventsAdjusting prices correctlyCorporate Actions, Delistings and Rolls in Backtests

Data sources#

Source typeExamplesNotes
FreeExchange websites, public APIs, some broker feedsOften limited history, survivorship bias, errors
Broker and platform dataData from trading platformsConvenient; check adjustments and gaps
Commercial vendorsProviders of research grade equity, futures and options dataCostly; point in time and delisted data available
Exchange historical productsOfficial tick and order book archivesHighest detail; expensive and large
Crypto exchange APIsTrade and order book historyFree but varies by exchange; venue differences

Data quality checks#

CheckWhat to look for
Missing periodsGaps in dates or times
OutliersImpossible jumps, prices outside the day's range. See Outliers and Robust Statistics
Zero or negative valuesBad records (except where negative prices really occurred)
Duplicate recordsRepeated bars or trades
Timestamp consistencyTime zones, daylight saving, bar labelling (start vs end). See Timestamps, Time Zones and Daylight Saving
Corporate actionsSplits and dividends handled correctly. See Splits and Dividends in Price Data
Cross checksCompare against a second source

Point in time data#

Fundamental data and index memberships must reflect what was known on each date, not later revisions or today's lists. Point in time databases preserve the original values. See Point-in-Time and Survivorship-Free Data and Look-Ahead Bias.

Futures and options data#

  • Futures: each contract expires, so long histories require continuous series built with roll rules and adjustments. See Continuous Futures and Back-Adjustment.
  • Options: many strikes and expiries; bid and ask quotes matter more than last trades, which can be stale.

How much history?#

Enough to include different market regimes: bull and bear markets, high and low volatility, rising and falling rates. For daily strategies, 10 to 20 years or more is common; for intraday strategies, several years of high quality intraday data may suffice, but should still cover varied conditions. See Structural Breaks and Regime Changes.

Data storage and versioning#

Store raw data unchanged, apply cleaning in documented steps and version datasets so backtests can be reproduced. See Data Storage, Compression and Caching and Data Versioning, Lineage and Schemas.

Frequently asked questions#

What data do I need for backtesting?#

Price data at the right frequency, adjusted for corporate actions, plus any fundamental or alternative data your strategy uses, all free of survivorship and look ahead bias.

Is free data good enough for backtesting?#

Sometimes for simple daily strategies, but free data often has errors, gaps and survivorship bias, so it should be checked carefully.

What is survivorship bias in data?#

Using only securities that exist today, which excludes failures and makes historical performance look better than it was.

Next, learn how to test on data the strategy has never seen in In-Sample vs Out-of-Sample Testing.

Check your understanding

3 quick questions on this lesson. Get them all right to finish it.

Turn on JavaScript to take the quiz.

Finished this lesson?Sign in to save your progress across devices.
Next lessonIn-Sample vs Out-of-Sample TestingOut of sample testing checks a strategy on data not used to build it. Learn train, validation and holdout splits, common mistakes and how to read results.

Mentioned in