ZeroLeak Backtest anti-lookahead validation builder
Catch AI backtest lookahead bugs.
Pick asset class, friction gates, and AI rule format to audit 5 silent Claude bugs + export a pytest integrity gate.
3. Mandatory Anti-Lookahead & Friction Gates (85/100 Integrity Score)
Crypto Perpetuals (CCXT Parquet) · Free Binance/Bybit/Hyperliquid OHLCV + Funding History
Models 5 bps taker / 2 bps maker + 8h/1h funding payments per held bar.
1. Unshifted Multi-Timeframe merge_asof (1m + 5m) (+1.8 to +3.4 fake Sharpe)
Claude merges 1m rows onto 5m bars indexed by bar-open timestamp, letting 10:01 read the 10:04 close of the 10:00 5m bar.
Broken AI Code (Leaks Future)
df_1m = pd.merge_asof(df_1m, df_5m, on='ts', direction='backward')
ZeroLeak Causal Fix
df_5m['ready_ts'] = df_5m['ts'] + pd.Timedelta('5min')
df_1m = pd.merge_asof(df_1m, df_5m.shift(1), left_on='ts', right_on='ready_ts', direction='backward')- 5-trap broken vs fixed diff
- Integrity score (0–100)
- Free pytest & CLAUDE.md gate
The short answer
How does ZeroLeak Backtest stop Claude & Cursor from faking Sharpe 5.0?
ZeroLeak Backtest audits the 5 silent lookahead bugs AI coding assistants commit in Python (unshifted MTF merge_asof, full-sample normalization, close[t] fills, omitted perp funding, and single-block overfitting) and exports a free pytest + CLAUDE.md integrity gate tailored to your asset class. Also check Prop Stress Test.
Details: how it works, sources and FAQ
Related validation checks
Sample size & Monte Carlo drawdown math
Check statistical significance using Backtest Sample Size Calculator or run trade-order shuffles in Monte Carlo Simulator.
Method
How it works, and what it doesn't do
Scores your backtest architecture across 5 causal integrity gates (MTF closed-bar shift, next-bar open + slippage fills, funding/commission ledger, purged walk-forward, and 1,000-run Monte Carlo) and demonstrates exact broken-vs-fixed Pandas code diffs.
The math: Integrity Score = Sum of Active Anti-Lookahead Gate Weights (0 to 100)
Runs in your browser: nothing you type or drop is uploaded. Your saved items stay in this browser. Updated 25 November 2026.
Questions
Common questions
What are the most common lookahead bugs Claude makes in Python backtests?
The top 5 bugs are unshifted pd.merge_asof multi-timeframe joins, full-dataset z-score normalization prior to train/test split, executing at signal-bar close[t], omitting perp funding/futures roll costs, and iterative overfitting on one in-sample block.
Why does filling at signal-bar close[t] break live trading?
In real markets you only know close[t] once bar t finishes, so the earliest causal fill is open[t+1] plus bid-ask spread and slippage.
How does the CLAUDE.md / .cursorrules export help?
It places hard architectural rules in your repository root so AI assistants cannot bypass causal shifting, slippage modeling, or pytest canary tests.
Related