First Backtest
With the dev stack running and market data seeded, you can run a backtest and inspect results in gordon-console.
The backtest = live invariant
Gordon has one strategy evaluation code path. The same Strategy::evaluate function runs inside gordon-bot's live loop and inside gordon-manager's backtest replay engine (BacktestExecution). There is no shadow engine, no Python reimplementation, no separate simulation model. A CI byte-parity gate (tests/it_backtest_live_byte_parity.rs) enforces this at every push.
This means backtest results are structurally trustworthy: what you see in the backtest is what the bot would have done.
Run a backtest via the console
Open http://localhost:3000 and navigate to Research in the sidebar. Select a strategy, symbol, and timeframe, then click Run Backtest.
Results appear in the runs list once the replay completes. Click a run to see:
- Performance stats (Sharpe, max drawdown, CAGR, win rate)
- Equity curve with drawdown overlay
- Roundtrip table with individual trade PnL, duration, and fees
Run a backtest via the BFF API
The manager BFF exposes a REST endpoint directly:
curl -X POST http://localhost:8083/backtest \
-H "Authorization: Bearer dev-operator-token" \
-H "Content-Type: application/json" \
-d '{
"strategy": "supertrend",
"symbol": "BTCUSDT",
"timeframe": "1d",
"from_ts": 1704067200000,
"to_ts": 1735689600000,
"params": {
"atr_period": 10,
"multiplier": 3.0
}
}'The response body contains a run_id. Query the run directly:
curl http://localhost:8083/runs/{run_id} \
-H "Authorization: Bearer dev-operator-token"Available strategies
| Strategy | strategy value | Validated timeframes |
|---|---|---|
| Supertrend 3.0 | supertrend | 1d, 8h |
| EWMAC ensemble | ewmac | 6h, 4h, 2h, 1h |
| PSAR tight | psar | 1w, 1d |
The 11 strategies added in 4.6.x (basis_revert, bollinger_breakout, funding_arb, hurst_regime_switcher, opening_range_breakout, pairs_mr, rsi_mean_reversion, tsmom, volume_spike_breakout, vpin_impulse, vwap_stretch_mr) are registered in the StrategyRegistry and available for backtesting, but their walk-forward validation is still in progress.
Interpreting results
- Sharpe ratio is annualized. Above 0.5 is acceptable for trend-following; above 0.9 is the current production threshold.
- Max drawdown shows the worst peak-to-trough decline. Trend-following systems routinely see 20-40% drawdowns — this is expected.
- Fees are included. The backtest applies Binance VIP 0 taker fees (4 bps) and estimated slippage per asset. Results are net of costs.
- Walk-forward validation separates real edge from curve-fitting. A single full-history backtest is not sufficient — see Walk-Forward Testing for the proper methodology.
Database tables written
Each backtest run writes to:
| Table | Content |
|---|---|
runs | One row per run — strategy, symbol, timeframe, parameters, timestamps |
trades | Individual fills (entry and exit) |
roundtrips | Matched entry-exit pairs with PnL, duration, fees |
equity_points | Account balance over time |
performance_snapshots | Aggregate metrics |
Query directly if needed:
make dev-psqlSELECT id, strategy, symbol, timeframe, sharpe, max_drawdown_pct
FROM runs
ORDER BY created_at DESC
LIMIT 10;Next step
Now that you have results, read Project Structure to understand how the v7 workspace is organized.