Backtest vs live trading: why they must share one code path

TL;DR AI
2 min readKey summary
The article argues that quant strategies often fail in production when backtests and live systems diverge in code, data handling, or state access.
It recommends a single pure strategy function, with separate backtest and live adapters calling the same logic.
Orders, logging, and persistence should live outside the strategy so the core decision code stays identical across environments.
This improves isomorphism, reduces lookahead bias and harness bugs, and makes optimization more trustworthy, though it does not solve slippage, latency, fees, or regime shifts.
