API reference ยท Exits and strategies
/v1/accounts/{account_id}/positions/{market}/exitsGet a position's exits.
Read
The take-profit and stop-loss legs this API keeps on the position: native orders on the engine, so they protect even when the API is away. Each group is at most the position: a take-profit fill trims the stop-losses by its size, the last fill cancels the rest.
Path parameters#
-
The account number.
-
A market id.
Responses#
200OK
-
The account number.
-
A market id: the asset and USD; an option adds its venue or hours after a dot.
-
The strategy that keeps these exits (type exits); null when there are none.
-
The open position; null when flat.
-
The take-profit legs: together at most the position.
Show 9 fields
-
The leg: an order of this API, also listed under the account's orders.
-
take_profit: a limit on the profit side. stop_loss: a stop on the loss side.
One of
take_profitstop_loss -
take_profit legs are limits; stop_loss legs are stop_market or stop_limit.
One of
limitstop_marketstop_limit -
The order's status; waiting: a stop-loss not placed yet (it waits for its activation price or its break-even).
One of
pendingworkingfilledcanceledrejectedexpiredunconfirmedwaiting -
Its size.
-
The take-profit price, or the stop price.
-
The limit of a stop_limit leg.
-
A trailing stop-loss: how it follows the price.
Show 5 fields
-
How far behind the best price (or null: percent).
-
How far behind, in percent of the best price (or null: distance).
-
It starts once the price reaches this; null: from the start.
-
It follows the price now (its activation price was reached, or it had none).
-
The best price since it started, which the stop follows.
-
-
A stop-loss moved to the entry price once the price has gone your way far enough.
Show 5 fields
-
How far from the entry the price must go (or null: another trigger).
-
The same, in percent of the entry.
-
Or once the price reaches this.
-
Ticks beyond the entry, on the profit side.
-
The stop-loss was moved to the entry already.
-
-
-
The stop-loss legs: together at most the position.
Show 9 fields
-
The leg: an order of this API, also listed under the account's orders.
-
take_profit: a limit on the profit side. stop_loss: a stop on the loss side.
One of
take_profitstop_loss -
take_profit legs are limits; stop_loss legs are stop_market or stop_limit.
One of
limitstop_marketstop_limit -
The order's status; waiting: a stop-loss not placed yet (it waits for its activation price or its break-even).
One of
pendingworkingfilledcanceledrejectedexpiredunconfirmedwaiting -
Its size.
-
The take-profit price, or the stop price.
-
The limit of a stop_limit leg.
-
A trailing stop-loss: how it follows the price.
Show 5 fields
-
How far behind the best price (or null: percent).
-
How far behind, in percent of the best price (or null: distance).
-
It starts once the price reaches this; null: from the start.
-
It follows the price now (its activation price was reached, or it had none).
-
The best price since it started, which the stop follows.
-
-
A stop-loss moved to the entry price once the price has gone your way far enough.
Show 5 fields
-
How far from the entry the price must go (or null: another trigger).
-
The same, in percent of the entry.
-
Or once the price reaches this.
-
Ticks beyond the entry, on the profit side.
-
The stop-loss was moved to the entry already.
-
-
-
The legs grow with the position, keeping their share of it (rounded down to the size step).
401The request has no Authorization header.
{
"error": {
"type": "authentication",
"code": "missing_api_key",
"message": "No API key: send it as Authorization: Bearer <key>.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#missing_api_key"
}
}403The key only works from the addresses you listed.
{
"error": {
"type": "permission",
"code": "ip_not_allowed",
"message": "This address is not on the key's allowlist.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#ip_not_allowed"
}
}404The account does not exist in this environment, or the key does not reach it.
{
"error": {
"type": "not_found",
"code": "account_not_found",
"message": "No account with that id is reachable with this key.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#account_not_found"
}
}429A request budget is used up (details.scope says which).
{
"error": {
"type": "rate_limit",
"code": "rate_limited",
"message": "Too many requests: slow down.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": true,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#rate_limited"
}
}500An error we did not expect.
{
"error": {
"type": "server",
"code": "internal_error",
"message": "Something went wrong on our side.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": true,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#internal_error"
}
}503The trading engine did not give a complete answer in time; nothing partial is returned.
{
"error": {
"type": "engine",
"code": "state_unavailable",
"message": "The account's figures cannot be read right now.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": true,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#state_unavailable"
}
}Errors#
Codes this endpoint can return. Match on the code, never on the message.