PhoenixPerpetualsDocs API v1
Get an API key

API reference ยท Risk and history

GET/v1/accounts/{account_id}/trading-policy

Get 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#

Responses#

200OK
  • ruleRule or nullrequired

    The account's rule, as the trading engine enforces it.

    Show 11 fields
    • start_balancedecimal stringrequired

      The balance the account started with.

    • daily_lossobject or nullrequired
      Show 4 fields
      • amountdecimal string or nullrequired

        The most the account may lose in a trading day, in USD.

      • pctdecimal string or nullrequired

        The same limit in percent of its basis.

      • basisstringrequired

        What the day's loss is measured from.

        One ofpeak_balancestart_balancepeak_equityday_start_balanceday_start_equity

      • on_breachstringrequired

        What happens when it is reached.

        One offail_accountflattenflatten_and_pause

    • max_drawdownobject or nullrequired
      Show 3 fields
      • amountdecimal string or nullrequired

        The most the account may fall from its reference, in USD.

      • pctdecimal string or nullrequired

        The same limit in percent.

      • modestringrequired

        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 ofend_of_dayend_of_tradestaticintraday_equity

    • weekly_lossobject or nullrequired
      Show 2 fields
      • amountdecimal string or nullrequired

        The most the account may lose in a week, in USD.

      • pctdecimal string or nullrequired

        The same limit in percent.

    • profit_targetobject or nullrequired
      Show 3 fields
      • amountdecimal string or nullrequired

        The profit to reach, in USD.

      • pctdecimal string or nullrequired

        The same target in percent.

      • requires_flatbooleanrequired

        Positions must be closed when it is reached.

    • min_trading_daysinteger or nullrequired

      Days with a trade the account needs.

    • min_calendar_daysinteger or nullrequired

      Calendar days the account needs.

    • consistencyobject or nullrequired
      Show 2 fields
      • amountdecimal string or nullrequired

        The most one day may bring, in USD.

      • pctdecimal string or nullrequired

        The most one day may bring, in percent of the total.

    • overnight_holdingbooleanrequired

      Positions may stay open overnight.

    • weekend_holdingbooleanrequired

      Positions may stay open over the weekend.

    • inactivity_daysinteger or nullrequired

      Days without a trade after which the account fails.

  • trading_dayobjectrequired
    Show 2 fields
    • timezonestringrequired

      The trading day runs midnight to midnight in this zone.

    • ends_atinteger, Unix msrequired

      When this one ends.

  • slippage_pctobjectrequired
    Show 3 fields
    • defaultdecimal string or nullrequired

      The bound a market order gets when it names none, in percent.

    • mindecimal string or nullrequired

      The tightest it may ask.

    • maxdecimal string or nullrequired

      The widest it may ask.

  • marginobjectrequired
    Show 2 fields
    • default_modestringrequired

      The margin mode of a market you never set.

      One ofisolatedcross

    • maintenance_margin_pctdecimal string or nullrequired

      The share of a position's margin kept as maintenance, in percent.

  • ordersobjectrequired
    Show 4 fields
  • controlsobjectrequired

    The limits you set on the key.

    Show 5 fields
    • marketsarray of stringrequired

      The markets the key may trade; empty: every market.

    • reduce_onlybooleanrequired

      The key may only reduce positions.

    • max_order_usddecimal string or nullrequired

      The largest order the key may place, in USD.

    • max_position_usddecimal string or nullrequired

      The largest position the key may hold, in USD.

    • daily_loss_usddecimal string or nullrequired

      The loss in a trading day at which the key stops trading the account.

  • budgetsobjectrequired
    Show 2 fields
  • as_ofinteger, Unix msrequired

    When the oldest figure here was read.

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"
  }
}
409The account exists but is not open on the trading engine yet.
{
  "error": {
    "type": "conflict",
    "code": "account_not_ready",
    "message": "This account is still being opened.",
    "request_id": "req_0f9c2a7d8e1b4c6a9f3e5d7b1a2c4e6f",
    "retryable": true,
    "doc_url": "https://docs.phoenixperpsfunding.com/reference/errors#account_not_ready"
  }
}
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.

Guides, endpoints, fields and error codes.