Skip to content

Get backtest results

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

A completed backtest’s performance numbers - profit, ROI, fees, risk metrics, order and position statistics, and the first log lines. Available once the status is completed.

Requires the partner scope.

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

200 OK. Returns a PartnerBacktestResults.

{
"backtest_id": "6f19dc7db5904c27a87c5d684ff8a889",
"market_tag": "BINANCE_BTC_USDT",
"started_at": "2026-08-28T20:30:00Z",
"ended_at": "2026-08-29T20:30:00Z",
"executed_start_at": "2026-08-29T20:31:04Z",
"executed_end_at": "2026-08-29T20:31:19Z",
"summary": {
"realized_profit": "128.44",
"profit_currency": "USDT",
"roi": "0.062",
"fee_costs": "4.1",
"gross_profit": "132.5",
"price_change": "0.031"
},
"performance": {
"profit_factor": "1.8",
"sharpe_ratio": "1.2",
"sortino_ratio": "1.6",
"max_drawdown": "22.5",
"max_drawdown_percent": "0.045",
"win_percentage": "0.61",
"biggest_win": "14.2",
"biggest_loss": "-6.1",
"highest_profit": "150",
"lowest_profit": "-12"
},
"orders": {
"total": 84,
"filled": 80,
"partially_filled": 1,
"average_open_time": "512"
},
"positions": {
"closed": 40,
"winning": 25,
"losing": 15,
"average_profit": "3.2",
"average_margin": "250"
},
"logs": [
{
"timestamp": "2026-08-28T20:30:00Z",
"severity": "info",
"message": "Backtest started."
}
]
}
Field Type Description
backtest_id string
market_tag string
started_at string Start of the simulated window (RFC 3339).
ended_at string End of the simulated window (RFC 3339).
executed_start_at string, nullable When execution began (RFC 3339).
executed_end_at string, nullable When execution finished (RFC 3339).
summary PartnerBacktestSummary
performance PartnerBacktestPerformance
orders PartnerBacktestOrders
positions PartnerBacktestPositionStats
logs array of PartnerBacktestLogEntry The first 50 log lines. The full log is at …/logs.
Field Type Description
realized_profit string (decimal)
profit_currency string, nullable
roi string (decimal)
fee_costs string (decimal)
gross_profit string (decimal)
price_change string (decimal) The market’s own price change over the window.
Field Type Description
profit_factor string (decimal)
sharpe_ratio string (decimal)
sortino_ratio string (decimal)
max_drawdown string (decimal)
max_drawdown_percent string (decimal)
win_percentage string (decimal)
biggest_win string (decimal)
biggest_loss string (decimal)
highest_profit string (decimal)
lowest_profit string (decimal)
Field Type Description
total integer (int32)
filled integer (int32)
partially_filled integer (int32)
average_open_time string (decimal) Average time an order stayed open, in seconds.
Field Type Description
closed integer (int32)
winning integer (int32)
losing integer (int32)
average_profit string (decimal)
average_margin string (decimal)
Field Type Description
timestamp string, nullable When the line was logged (RFC 3339), or null if it carried no timestamp.
severity string info, trade, warning, error, or custom.
message string

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 completed 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"
}