Skip to content

Get backtest status

GET https://rest.haasapi.com/v1/partner/backtests/{backtest_id}/status

The backtest’s execution state and progress. Poll until state is completed, then read the results, logs and positions.

Requires the partner scope.

Terminal window
curl "https://rest.haasapi.com/v1/partner/backtests/{backtest_id}/status" \
-H "Authorization: Bearer hk_live_YOUR_KEY"

200 OK. Returns a PartnerBacktestStatus.

{
"backtest_id": "6f19dc7db5904c27a87c5d684ff8a889",
"state": "executing",
"progress": 42,
"message": "Simulating candles.",
"service_id": "se-1f2c9a"
}
Field Type Description
backtest_id string
state string loading_script, loading_data, executing, completed, or failed.
progress integer (int32) Percent complete, 0-100.
message string, nullable
service_id string, nullable The id of the execution service handling the job. Remains set after the job finishes; use state to tell whether it is still running.

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. (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"
}