What you will learn
- Timestamp data by when it became known and avoid look-ahead bias.
- Build a historical universe that includes delisted securities.
Data must be timestamped by availability
A backtest should use only information that existed at the decision time. Each data point therefore needs an availability timestamp, the moment it became public, not the period it describes. Annual results for a December year-end may appear two or three months later.
Restatements complicate this. Vendors often overwrite old figures with corrected ones, so a database showing only final values leaks information from the future. Point-in-time databases keep every version with its release date.
Common sources of look-ahead bias
Look-ahead bias enters when a signal uses a bar's close and the trade also executes at that close, when statistics such as means or standard deviations are computed over the whole sample, or when parameters are chosen after seeing the full history.
Prevent it by executing decisions made with data through time t no earlier than the next bar, computing statistics with rolling or expanding windows, and checking one example by hand: could a trader have known this value then?
Universe construction and survivorship
The universe is the set of instruments eligible on each date. Testing today's listed companies over a long past period removes firms that failed, were acquired cheaply or delisted. This survivorship bias inflates results.
Build the universe from historical membership, such as past index constituents, and keep delisted securities with their final returns. Apply liquidity or size filters using each date's values, not today's.
Worked example: How much survivorship adds
A fictional equal-weight test starts with 10 stocks worth 100 each, 1,000 in total. Seven survive and end at 200 each, 1,400 in total. Three were delisted and ended at 20 each, 60 in total. The honest result is 1,460 ÷ 1,000 = +46%. Testing only the seven survivors gives 1,400 ÷ 700 = +100%, overstating the result by 54 percentage points.
Check your understanding
A test starts with 20 equal-weight stocks. Sixteen finish up 50% and four were delisted after losing 90%. What is the average return for the full universe and for the survivors alone?
Show answer and explanation
The full universe averages (16 × 1.50 + 4 × 0.10) ÷ 20 = 24.4 ÷ 20 = 1.22, a 22% gain. The survivors alone show 50%, so survivorship bias adds 28 percentage points. Dropping failed firms materially changes the conclusion.