Results & stats
BacktestResult
What a backtest returns / writes.
| Field | Type | Meaning |
|---|---|---|
equity_curve | list[(datetime, float)] | Account value over time |
trades | list[OrderFilled] | Every fill |
stats | dict | Summary (below) |
Written to disk as equity.csv, trades.csv, stats.json under results/<stamp>/.
Stats
Both models report:
| Key | Meaning |
|---|---|
total_return | Overall return |
max_drawdown | Worst peak-to-trough drop |
sharpe | Risk-adjusted return |
Intraday adds a daily block — the per-day P&L distribution:
| Key | Meaning |
|---|---|
n_days | Number of trading days |
mean_pnl / std_pnl | Mean and standard deviation of daily P&L |
win_rate | Fraction of profitable days |
best_day / worst_day | Best and worst single-day P&L |
Portfolio and Position
self.portfolio exposes cash and positions. self.portfolio[symbol] returns a Position with symbol, qty, avg_price. self.portfolio.equity(prices) marks the book to market.
BacktestConfig
Programmatic config: symbols, start, end, starting_cash (default 100,000), resolution ("daily" or "minute" — picks the model).