Lesson 6 · 20 min
Performance metrics & debugging
Sharpe, drawdown, CAGR — and fixing the errors you will see in the lab.
SharpeDrawdownDebug
A backtest without metrics is just a chart. Quant Buffet reports risk-adjusted statistics so you can compare strategies — and provides an AI debugger when code breaks.
Drag the sliders to see how Sharpe and Calmar react. These are the same families of stats Quant Buffet reports after a lab run.
Sharpe (approx.)
0.44
(CAGR − RF) / Vol
Calmar (approx.)
0.55
CAGR / |Max DD|
Interpretation
Weak — check overfitting or costs
| Lab error | Likely fix |
|---|---|
| Signal never ready | Shorten lookback or extend start date; check ASSETS history. |
| Import blocked | Only backtest.*, numpy, pandas — see API docs. |
| Symbol not in whitelist | Use ETFs from backtest.universes (SPY, TLT, GLD…). |
| Equity curve too short | Ensure on_day actually calls set_target_weights. |
Metrics glossary
| Metric | What it tells you | Healthy scepticism |
|---|---|---|
| CAGR | Average yearly growth if path repeated | One great decade can inflate it |
| Volatility | How bumpy the ride is | Low vol can mean hidden leverage |
| Sharpe | Return per unit of risk | Meaningless if only 2 years of data |
| Max drawdown | Worst peak-to-trough loss | Can you hold through it live? |
| Alpha / Beta | Excess return vs SPY; market sensitivity | Proxy benchmark ≠ your live book |
| Win rate | % of positive days | High win rate can still lose money |
Debugging workflow
- Read the error message and line number in the lab panel.
- Open the syntax cheat sheet — compare to required
ASSETS+make_on_day. - Click Ask AI for syntax — step-by-step fixes with copy-paste snippets.
- Consult API docs for imports, whitelist symbols, and template examples.
- Re-run with a shorter ASSETS list and later
startdate to isolate data issues.
# After a local or lab run
metrics = compute_metrics(result.equity, benchmark=spy_bh, trades_count=len(result.trades))
print(metrics["sharpe"], metrics["max_drawdown"])