Get backtest status
GET https://rest.haasapi.com/v1/backtests/{backtest_id}
The job poll: status while the backtest is queued or running, and the result summary once finished. A failed job stores no record, so it answers 404 once its live execution entry expires.
Requires the read scope.
Example request
Section titled “Example request”curl "https://rest.haasapi.com/v1/backtests/{backtest_id}" \ -H "Authorization: Bearer hk_live_YOUR_KEY"Response
Section titled “Response”200 OK. Returns a BacktestJob.
{ "backtest_id": "6f19dc7db5904c27a87c5d684ff8a889", "status": "finished", "script_id": "7a4b2f91d6e53c8942a0bd7e1f5896c4", "account_id": "af85799d-a214-4fd2-92ea-443c5eed18ad", "market_tag": "BINANCE_BTC_USDT", "interval": null, "start_at": "2026-08-28T20:30:00Z", "end_at": "2026-08-29T20:30:00Z", "result": { "realized_profit": "0", "fees": "0", "roi": "0", "profit_currency": "USDT", "orders_filled": 0, "positions_closed": 0, "win_rate": "0" }}Fields
Section titled “Fields”BacktestJob
Section titled “BacktestJob”| Field | Type | Description |
|---|---|---|
backtest_id |
string | Backtest identifier, minted by the server on POST /v1/backtests - the id every other backtest endpoint accepts. |
status |
BacktestStatus | Job status. queued - accepted, loading the script and price history; running - executing; finished - done, result is set; failed - the execution failed. A failed job keeps no stored record, so it eventually answers 404. |
script_id |
string, nullable | The HaasScript the backtest runs. null when the stored record no longer carries it. |
account_id |
string, nullable | The account whose fees and wallet the simulation uses. null while the backtest is still executing - the live execution record does not carry it. |
market_tag |
string, nullable | The market the backtest ran on - joins against market_tag on /v1/markets. null while the backtest is still executing. |
interval |
integer (int32), nullable | Chart interval in minutes. Echoed on the 202 answer; null on later polls - the stored record does not carry it. |
start_at |
string, nullable | Start of the backtested window, RFC 3339 UTC. null while the backtest is still executing. |
end_at |
string, nullable | End of the backtested window, RFC 3339 UTC. null while the backtest is still executing. |
result |
BacktestResult | The result summary. Set only when status is finished; null otherwise. |
BacktestResult
Section titled “BacktestResult”| Field | Type | Description |
|---|---|---|
realized_profit |
string (decimal) | Realized profit over the backtested window, in profit_currency. |
fees |
string (decimal) | Total fee costs, in profit_currency. |
roi |
string (decimal) | Return on investment, percent. |
profit_currency |
string | The currency the profit and fee figures are denominated in. |
orders_filled |
integer (int32) | Orders that filled during the backtest. |
positions_closed |
integer (int32) | Positions closed during the backtest. |
win_rate |
string (decimal) | Winning positions as a percentage of closed positions, 0-100. |
Errors
Section titled “Errors”All errors are RFC 9457 problem documents.
| Status | Description |
|---|---|
400 |
The request is malformed (invalid limit, unusable cursor, …). (code: invalid_request) |
401 |
Missing, malformed, disabled, or revoked API key. (code: invalid_api_key) |
404 |
No backtest with that id - unknown, deleted, or failed and discarded. (code: backtest_not_found) |
500 |
An unexpected error inside the API. Nothing about the request caused it; retry, and quote the instance value if it persists. (code: internal_error) |
502 |
An internal service answered in a way the API could not serve. Retry. (code: upstream_error) |
503 |
The request could not be served right now. Retry with the same key - do not discard it. (code: temporarily_unavailable) |
504 |
An internal service did not answer within the deadline. Retry with backoff. (code: upstream_timeout) |
{ "type": "https://docs.haasapi.com/errors/invalid_request", "title": "Invalid request", "status": 400, "detail": "The request is malformed (invalid limit, unusable cursor, …).", "code": "invalid_request"}