Quant Buffet API
API Reference
Libraries, classes, and syntax for writing strategies in the Quant Buffet backtest lab — from ASSETS and make_on_day through PortfolioEngine and compute_metrics.
Overview
What the Quant Buffet backtest API is, what the sandbox gives you for free, and how a run executes end to end.
02Lab contract
Required symbols, function signatures, ready semantics, and the make_on_day → on_day pattern.
03Syntax cookbook
The pandas and numpy syntax you actually need: panel access, indicators, cross-sectional ranking, weights, and cadence.
04Data API
load_daily_prices, load_price_panel, the disk cache, and price panel conventions.
05Engine API
PortfolioEngine, EngineConfig, the exact fill algorithm, Trade, and BacktestResult.
06Metrics API
compute_metrics: every output field, the exact formulas, and benchmark-relative stats.
07Templates
The nine make_* factories in backtest.templates, with exact parameter names and rebalance cadence.
08Universes & whitelist
Named ETF books and the 81 symbols the sandbox will accept in ASSETS.
09Sandbox rules
Allowed imports, the exact builtins you get, blocked calls, and hard runtime limits.
10Lab run API
The JSON contract between the browser IDE, the HTTP routes, and the Python runner.
11Errors & troubleshooting
Every error type the sandbox can return, what actually causes it, and the fix.
12Examples
Complete, runnable strategy patterns for the lab and for local scripts.