Companion notebook for the post “Algo Backtests Are Lying to You.” It recreates the article’s synthetic experiments, then reruns the same ideas on live SPY and BTC-USD candles via backtesting.py.
- Install deps with
uv sync(oruv pip install -r pyproject.toml). - Launch Jupyter:
uv run --frozen jupyter lab(oruv run --frozen jupyter notebook). - Open
python/convex.ipynband run cells top-down. Section 6 fetches real data; you’ll need network access for theyfinancepulls.
- Gaussian comfort zone — deterministic SMA edges in a tidy world.
- Fat tails, shocks, quantile payoffs, and Monte Carlo convex/concave contrasts.
- Regime-shift stress test synthesizer.
- Real-data sanity check with
backtesting.pyacross SPY and BTC regimes.
Feel free to adjust the RNG seed, regime definitions, or add your own instruments to falsify strategies faster.