API reference ยท Risk and history
/v1/accounts/{account_id}/trading-policyGet the trading policy.
Read
Everything that decides whether an order goes through: the rule, the trading day, slippage bounds, margin, order limits, the limits you set on the key and its budgets.
Path parameters#
-
The account number.
Responses#
200OK
-
The account's rule, as the trading engine enforces it.
Show 11 fields
-
The balance the account started with.
-
Show 4 fields
-
The most the account may lose in a trading day, in USD.
-
The same limit in percent of its basis.
-
What the day's loss is measured from.
One of
peak_balancestart_balancepeak_equityday_start_balanceday_start_equity -
What happens when it is reached.
One of
fail_accountflattenflatten_and_pause
-
-
Show 3 fields
-
The most the account may fall from its reference, in USD.
-
The same limit in percent.
-
How the reference moves: end_of_day and end_of_trade follow the highest balance, static stays at the start, intraday_equity follows the highest equity.
One of
end_of_dayend_of_tradestaticintraday_equity
-
-
Show 3 fields
-
The profit to reach, in USD.
-
The same target in percent.
-
Positions must be closed when it is reached.
-
-
Days with a trade the account needs.
-
Calendar days the account needs.
-
Positions may stay open overnight.
-
Positions may stay open over the weekend.
-
Days without a trade after which the account fails.
-
-
Show 2 fields
-
The margin mode of a market you never set.
One of
isolatedcross -
The share of a position's margin kept as maintenance, in percent.
-
-
Show 5 fields
-
Working orders the account may hold.
-
New orders a minute.
-
How far from the market price a priced order may be, in percent.
-
The oldest price an order is checked against, in seconds.
-
The oldest unchanged price of a quiet market an order is checked against, while the price feed lives (other markets move), in seconds.
-
-
The limits you set on the key.
Show 5 fields
-
The markets the key may trade; empty: every market.
-
The key may only reduce positions.
-
The largest order the key may place, in USD.
-
The largest position the key may hold, in USD.
-
The loss in a trading day at which the key stops trading the account.
-
-
Show 2 fields
-
Reads a minute for this key.
-
Trading calls a minute for this key.
-
-
When the oldest figure here was read.
304Not Modified: your If-None-Match still matches (no body; nothing changed).
400The request carries something this route does not know, or a parameter twice.
{
"error": {
"type": "invalid_request",
"code": "unknown_field",
"message": "A parameter or field is not part of this route.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#unknown_field"
}
}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"
}
}405The path exists, with other methods (see the Allow header).
{
"error": {
"type": "method",
"code": "method_not_allowed",
"message": "This route does not take that method.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#method_not_allowed"
}
}409The account was closed: it has no live figures, positions or orders any more. GET /v1/accounts/{account_id} still shows it, as closed.
{
"error": {
"type": "conflict",
"code": "account_closed",
"message": "This account is closed.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#account_closed"
}
}414The URL is over the length limit.
{
"error": {
"type": "payload",
"code": "uri_too_long",
"message": "The address is too long.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": false,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#uri_too_long"
}
}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"
}
}503A service this call needs did not answer.
{
"error": {
"type": "server",
"code": "temporarily_unavailable",
"message": "This cannot be done right now. Try again in a moment.",
"request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
"retryable": true,
"doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#temporarily_unavailable"
}
}Errors#
Codes this endpoint can return. Match on the code, never on the message.
- 401
missing_api_key - 401
invalid_api_key - 401
expired_api_key - 401
revoked_api_key - 401
invalid_token - 401
expired_token - 401
revoked_token - 401
wrong_resource - 401
wrong_environment - 403
ip_not_allowed - 403
api_disabled - 429
rate_limited - 503
temporarily_unavailable - 404
account_not_found - 409
account_closed - 503
state_unavailable - 409
account_not_ready