Backtest leakage
When a historical test uses information unavailable at the time.
Library note. Check the assumptions and further reading before applying a formula.
What Is This?
A backtest should replay what a decision-maker could actually have known. Leakage slips future information into that decision. It can enter through revised datasets, a price that was not yet tradable, or a scaling rule fitted to the whole history. The code may run correctly while the experiment answers an impossible question.
Try an example
You fit a scaler using every date, then train a model on the first half and test on the second. The training values now depend on the future test distribution. Fit the scaler on the training window and carry it forward unchanged.
Where it needs care
Removing leakage repairs the experiment; it does not establish a profitable strategy. Include fees, timing, instrument availability and a suitable passive benchmark. Record how many alternatives you tried.
Historical Context
Look-ahead and selection bias were known before machine learning. Automated pipelines create more places for these older experimental errors to hide.
Real-World Applications
- Audit time-stamped feature pipelines.
- Keep validation labels and future revisions out of training.