Run backtest
run_backtestReplays one of your saved strategies on historical candles and returns the summary: trade count, win rate, profit factor, drawdown, return and data coverage. Use it to test a strategy from get_my_strategies on past data; it is research, not a forecast, and places no orders. To reread an earlier run use get_my_backtests or get_backtest, which spend no compute quota; to change the settings first use update_strategy; for how published signals actually did use get_signal_ledger. Needs an API key with write scope and spends compute quota (beta: 5 runs a day, 1 a minute); a run can take up to about 85 seconds and returns an error if it does not finish. from and to are UTC dates at most 90 days apart, from 2018-01-01 to today; symbol defaults to the strategy's first symbol and is required when it lists none; initial_capital sets the starting balance the return and drawdown are measured on.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"strategy_id": "<strategy_id>",
"from": "<from>",
"to": "<to>"
},
"name": "run_backtest"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | End date, YYYY-MM-DD (UTC), at most 90 days after from. | |
| from | Yes | Start date, YYYY-MM-DD (UTC). | |
| symbol | No | Pair to replay. Required when the strategy lists no symbols; otherwise one of the strategy's symbols (default: its first). | |
| timeframe | No | Candle timeframe. | 4h |
| strategy_id | Yes | Id of one of your strategies (get_my_strategies). | |
| initial_capital | No | Starting capital in USDT for the replay. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | End date (UTC). | |
| from | No | Start date (UTC). | |
| note | No | Research, not a forecast. | |
| error | No | Set only on a failed call (isError true): what went wrong. | |
| stats | No | Win rate, profit factor, drawdown, return and related figures from the worker; absent if it returned none. | |
| status | No | Run status. | |
| symbol | No | Pair replayed. | |
| duration | No | Worker run time. | |
| timeframe | No | Candle timeframe. | |
| backtest_id | No | Run id. | |
| strategy_id | No | Strategy replayed. | |
| trade_count | No | Trades in the replay. | |
| data_coverage | No | How much of the range had candles; absent if unknown. | |
| strategy_name | No | Its name. | |
| initial_capital | No | Starting balance, USDT. |