How to Backtest a Trading Strategy in Python
Three runs of backtest.py on the illustrative 60-bar fileranking ·
2026-09-16 · 3×4
Three runs of backtest.py on the illustrative 60-bar file
Three runs of backtest.py on the illustrative 60-bar file
| run | total_return_pct | max_drawdown_pct | round_trips |
|---|---|---|---|
| raw tape | -49.84 | -50.01 | 2 |
| split-adjusted | 1.19 | -3.91 | 2 |
| split-adjusted, 0.1% slippage | 0.69 | -3.9 | 2 |
the exact SQL behind every number
SELECT
run,
total_return_pct,
max_drawdown_pct,
round_trips
FROM
(
SELECT 1 AS step, 'raw tape' AS run, -49.84 AS total_return_pct, -50.01 AS max_drawdown_pct, 2 AS round_trips
UNION ALL
SELECT 2, 'split-adjusted', 1.19, -3.91, 2
UNION ALL
SELECT 3, 'split-adjusted, 0.1% slippage', 0.69, -3.90, 2
)
ORDER BY step
Related queries
When market headlines publish, by New York clock hour
ranking 24×2
→
Growth of one dollar: holding all year vs holding only November through April
ranking 21×3
→
S&P 500 tracker: May to October vs November to April, season by season
ranking 21×3
→
SPY distributions by ex-dividend month: inside the May to October window vs outside it
ranking 19×3
→
See all 2,272 queries →