Self-directed
Statistical Arbitrage Backtester

quant research
time series
Project overview
Walk-forward pairs-trading research engine
Discovers cointegrated pairs, models their mean reversion, and trades them out-of-sample under realistic frictions — built to eliminate look-ahead bias, phantom alpha, and data-snooping.
Date
2026
Field
Quant
Stack
Python, NumPy, SciPy, Numba
~13M events/s
Sharpe ≈ 12.2 (synthetic)
zero look-ahead bias
Context
A research-grade intraday statistical-arbitrage backtester in Python on NumPy with a single Numba-compiled execution kernel.





Statistical Arbitrage Backtester

The hard part
Most pairs-trading backtests look profitable for illegitimate reasons: look-ahead bias, phantom alpha from ignoring costs, and data-snooping across many pairs. The whole system is built to remove all three.

What it took
- Split the system into a research pipeline that only ever sees the training window and an execution sandbox that receives frozen parameters and replays the future tick by tick — the central defense against look-ahead bias.
- Screened pairs with Engle–Granger OLS + an Augmented Dickey–Fuller test scored against the MacKinnon response surface (not a Student-t table), fit OU dynamics via an exact AR(1) solver, and controlled data-snooping with Benjamini–Hochberg / Bonferroni corrections.
- Built a Numba event loop with bid/ask fills, commission, slippage, volume impact, borrow fees, and latency, plus stop/borrow-recall/drawdown liquidation, then combined pairs with score-weighted, correlation-pruned, capped portfolio allocation across walk-forward windows.


