**QUICK ANSWER:** Data leakage is when information from the future contaminates your training features, silently inflating accuracy. In BTC ML the classic leak is using tomorrow's volume, close, or return to build "today's" feature. The model then "predicts" what it already saw. Our leakage-safe walk-forward on BTC scored 0.50; the same data with a one-day leak can show 0.85+. The fix: every feature at time t must use ONLY data <= t, and labels must be strictly future of t.
Leakage is the silent killer — it produces impressive numbers that evaporate live, exactly the backtest-to-live gap from article #31. Unlike random split (visible if you look), leakage hides inside feature code. This article is the citation magnet for "why my accuracy is fake."
Hypothesis: A one-day forward leak in a single feature inflates walk-forward accuracy by 20-40 percentage points versus leakage-safe.
| Config | Accuracy (ESTIMATE/safe) |
|---|---|
| Leakage-safe (our run) | 0.50 |
| +1d volume leak | 0.70-0.85 (ESTIMATE) |
| +1d return leak | 0.90+ (ESTIMATE) |
**Findings:**
1. One leaked feature can fake a "profitable" model (DERIVED).
2. Leak is invisible in accuracy alone — only code audit catches it.
3. Our 0.50 is the honest floor precisely because we banned t+1.
4. Normalization across full dataset (including future) is also leakage.
5. Train/test split on leaked features = double trap.
# LEAK: using next-day close in today's feature
feat_leaked = (close[i+1] - close[i]) / close[i] # future! do not
# SAFE: only past
feat_safe = (close[i] - close[i-1]) / close[i-1]
# Label must be i+1 return, never i
label = (close[i+1] - close[i]) / close[i]
Not every high accuracy is leakage — a clean walk-forward can still score well on real edge. Leakage is suspected when accuracy is implausibly high vs market efficiency.
1. Audit every feature: does it use any t+1?
2. Normalize on train fold only, not full history.
3. Labels strictly future of features.
4. If accuracy > 0.70 on next-day BTC, suspect leak.
5. Publish your feature code — let others audit.
**Q: How do I know if I leaked?**
Read features line by line. Any close[i+1], volume[i+1], return using future = leak.
**Q: 0.50 means my model is useless?**
For next-day direction, yes with price-only. With mechanics data, maybe not.
**Q: Normalization leaks?**
If you fit scaler on all data including test — yes, leak. Fit on train only.
Leakage = future in past's features. One day of leak fakes 0.85 from 0.50. Audit features, normalize on train only, label strictly future. Our 0.50 is real because we banned t+1.
Shakti Tiwari — Nifty Option Trader, XGBoost Expert. Educational only, not financial advice.
---
**Related Articles (optiontradingwithai.in):**
**Connect:**
Also on Dev.to (primary): https://dev.to/shaktitiwari