List a bot's closed positions
GET https://rest.haasapi.com/v1/partner/users/{user_id}/bots/{bot_id}/positions/closed
Returns a bot’s most recent closed positions. The most recent page only.
Requires the partner scope.
Example request
Section titled “Example request”curl "https://rest.haasapi.com/v1/partner/users/{user_id}/bots/{bot_id}/positions/closed" \ -H "Authorization: Bearer hk_live_YOUR_KEY"Response
Section titled “Response”200 OK. Returns a PartnerBotPositions.
{ "data": [ { "position_id": "p-9", "status": "closed", "market": "BINANCE_BTC_USDT", "direction": "long", "enter_price": "25000", "exit_price": "26000", "amount": "0.01", "realized_profit": "9.5", "unrealized_profit": "0", "roi": "0.038", "fee_costs": "0.5", "leverage": "0", "opened_at": "2026-08-27T10:00:00Z", "closed_at": "2026-08-28T14:00:00Z", "order_count": 4 } ], "next_cursor": null}Fields
Section titled “Fields”PartnerBotPositions
Section titled “PartnerBotPositions”| Field | Type | Description |
|---|---|---|
data |
array of PartnerBotPosition | The bot’s positions. |
next_cursor |
string, nullable | For paged (closed) positions: pass as cursor for the next page; null on the last page or for the open-positions read. |
PartnerBotPosition
Section titled “PartnerBotPosition”| Field | Type | Description |
|---|---|---|
position_id |
string | |
status |
string | open or closed. |
market |
string, nullable | |
direction |
string | long or short. |
enter_price |
string (decimal) | |
exit_price |
string, nullable | The average exit price for a closed position; null while open. |
amount |
string (decimal) | |
realized_profit |
string (decimal) | |
unrealized_profit |
string (decimal) | |
roi |
string (decimal) | |
fee_costs |
string (decimal) | |
leverage |
string (decimal) | |
opened_at |
string | When the position opened. RFC 3339 UTC. |
closed_at |
string, nullable | When the position closed; null while open. RFC 3339 UTC. |
order_count |
integer (int32) |
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 accessible bot with that id for this end-user. (code: bot_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"}