Skip to main content

Recipe: run a backtest from YAML

$resp = curl -X POST http://localhost:8000/backtest `
-H "Content-Type: application/json" `
-d (Get-Content configs/strategies/my-strategy.yaml -Raw)

# Tail progress (canonical {task_id, stage, message, timestamp} frames).
docker exec alphaswarm-api python -c "from alphaswarm.ws.broker import subscribe; \
[print(m) for m in subscribe('<task_id>')]"

Choose your engine

The default engine is vbtpro (vectorbt-pro primary). Override with --engine event_driven / hft / vectorbt / backtesting_py / zvt / aat. See backtest engines for the capability matrix and fallback cascade.

Walk-forward + WFO

curl -X POST http://localhost:8000/backtest/wfo `
-d '{"strategy_config":"configs/strategies/my-strategy.yaml","windows":12,"step":"1mo"}'

The endpoint dispatches one task per window; each writes its own backtest_runs row and the parent emits a wfo.complete frame when every window is in.

Look at results

  • backtest_runs row in Postgres for the headline metrics.
  • alphaswarm_gold_backtest_<run_id> Iceberg namespace for trade-level detail.
  • The QuantStats tearsheet endpoint at POST /analytics/portfolio/tearsheet for an HTML report.

Deeper reads