Algorithmic Trading.
Signals, backtests, and the discipline that separates edge from artefact.
3 articles · each one with a runnable notebook
The SMA Crossover, Honestly Backtested: QQQ and Bitcoin, Costs Included
The moving-average crossover is trend following's workhorse — and the perfect vehicle for backtesting discipline 101. We run the same long-or-flat rule on QQQ and BTC-USD over 2015–2024, close the lookahead gap with one shift(1), charge 10bp a side, then sweep a 4×4 parameter grid: QQQ's grid straddles buy-and-hold while BTC's sits above it. Trend behaves differently per asset.
Kalman Filters for Dynamic Hedge Ratios: Tracking a Beta That Refuses to Sit Still
Static hedge ratios assume the relationship never moves; on EWA/EWC 2010–2024 it moves from 0.71 to 1.49. We treat beta as a random-walk state, filter it in five lines of NumPy, and trade the spread both ways — the Kalman beta wins as an estimator (gross Sharpe 0.55 vs 0.47, half the drawdown), while 10 bp costs on 2.7× turnover decide the net line.
Anatomy of a Short Squeeze: GameStop, January 2021, Reconstructed From the Tape
In January 2021, GameStop ran from $4 to $120. We reconstruct the mechanics in data — short interest, days-to-cover, the options gamma loop — and measure the risk that a short book never priced.


