← Projects·Quantitative Researcher

Look-Ahead Bias Audit (the shift test)

A bias-hunting toolkit: deliberately introduce a look-ahead leak into a backtest, then detect it with a one-line shift test. If the leak survives, the equity curve is a phantom.

0.59
Clean Sharpe
5.07
Leaked Sharpe
88%
Phantom % detected
of the inflated Sharpe is leakage
Status
open-source

Why this exists

Look-ahead bias is the silent killer of every quantitative backtest. The researcher thinks the signal uses yesterday’s close; the code uses today’s. The result is an equity curve that looks like alpha and turns out to be a leak.

What the project does

  1. Run a backtest with the signal as designed.
  2. Shift the data by one bar forward — replicating what would happen if the signal accidentally used tomorrow’s price.
  3. Compare the two Sharpe ratios.

The result

Sharpe decomposition: real α vs look-ahead phantom
Clean0.59Leaked5.07Real α0.55Phantom4.48
One-bar shift test exposes the leak: leaked Sharpe (5.07) − real α (0.55) ≈ 4.48 phantom Sharpe from a one-bar forward shift. 88% of the apparent edge was leakage.
  • Clean Sharpe: 0.59 (real signal).
  • Leaked Sharpe: 5.07 (real leakage).
  • 88% of the inflated Sharpe is leakage, not alpha.

What’s transferable

The one-bar shift test is a one-line audit that catches the most expensive error class in research. Every production research stack should run it as a pre-ship check — before the strategy is ever traded.

Want to see this project in your stack?

Every project is runnable in one command. The scorecard is the contract.