Endpoints · Strategies

Backtest a strategy

GET/v2/strategies/{name}/backtest

Runs the strategy through historical bars at its own configured cadence interval (the backtest does **not** take an `interval` override — backtesting at a cadence different from the one the strategy is configured for produces results that don't reflect how the strategy would actually run). Entries fire on false→true transitions; exits evaluate first each bar, first-match-wins. PnL is computed per fill with `cost_bps` applied to both sides. Returns `{ trades, equity_curve, summary }` per STRATEGY_DESIGN.md §7. The equity curve enables Sharpe + drawdown calculation and dashboard charts; the summary is what the dashboard's metric strip displays. **MVP scope.** The engine currently supports: single-leg strategies, single-ticker `what` only, `fixed_fractional` sizing only, single-string (non-tranched) entry, full-close exits (`size_pct = 100`), and exit types `stop_loss_pct`, `take_profit_pct`, `trailing_stop_pct`, `max_hold_bars`, `signal_off`, `signal_on`. Long is fully supported; short is recognised but not yet wired. Strategies outside this envelope get a 400 `not_supported` naming the first unsupported feature.

Plan access

Hobby and above.

Rate limit

Hobby 60/min · Pro 2,000/min · Scale 10,000/min.

Capacity

Counts against your saved-rule capacity until v1.5 introduces a separate cap.

stringrequired

Strategy slug.

string

Earliest bar (inclusive). ISO timestamp or epoch ms. Defaults to 90 days ago.

string

Latest bar (inclusive). ISO timestamp or epoch ms. Defaults to now.

numberdefault 5

Round-trip cost in basis points, applied to both sides of every fill. Non-negative.

200
{ as_of, trades, equity_curve, summary }. See response example for shapes.
400
not_supported (strategy outside MVP envelope; message names the gap), compile_failed (entry/exit SQL did not compile), or bad_request (invalid cost_bps).