> ## Documentation Index
> Fetch the complete documentation index at: https://takeprofit.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Order data stream

> Everything needed to size and round an order on one instrument: price and quantity steps, fees, leverage, your account settings and live buying power.

The order data stream tells you what the exchange will accept on one instrument of one account. Connect to `wss://public-api.charting.com/api/v1/trading/order/data/stream` with `accountId`, `exchange`, `symbol`, and `connectorCode` when the account has more than one connector. Sign the handshake like a GET (see [Sign every request](https://takeprofit.com/docs/platform-api/trading/api-keys.md#sign-every-request)).

## Frames

The first frame is a `snapshot` with:

* **`instrumentInfo`:** price and quantity bounds and steps, `quantityUnit`, maker and taker fees, leverage bounds, slippage and trailing stop bounds.
* **`accountSettings`:** your settings for the instrument, such as `positionMode` and leverage.
* **`riskLimits`:** the instrument's risk limits for your account.
* **`userRebateRate`:** your cashback rate on this account. It's fixed for the life of the stream.

Then:

| Frame | Sent when |
| - | - |
| `buyingPower` | Buying power or total equity changed. Buying power isn't in the snapshot: the first `buyingPower` frame usually follows right after it. |
| `instrumentInfo`, `accountSettings`, `riskLimits` | That part changed. The frame is always complete: replace the part you hold. |
| `currencyRates` | Conversion rates between assets changed. |
| `hmrLeverage` | Exness only: the instrument's higher-margin window changed. |
| `error` | The stream ended. The socket closes after it. |

`buyingPower` and `currencyRates` can change many times a second. Pass `throttlingDelay`, in milliseconds up to `60000`, to get at most one of each per interval, always the newest.

## Before sending an order

* Round the price to `instrumentInfo.price.step`.
* Keep the quantity between `instrumentInfo.quantity.min` and `max`, in steps of `quantity.step`, counted in `quantityUnit`.
* Send `positionMode` from `accountSettings` when the connector needs it.

The exchange rejects an order that breaks these rules, and the rejection arrives on the [events stream](https://takeprofit.com/docs/platform-api/trading/events-stream.md).

This stream costs credits and follows the connection rules of the events stream: see [Staying connected](https://takeprofit.com/docs/platform-api/trading/events-stream.md#staying-connected).


## AsyncAPI

````yaml platform-api/specs/trading-asyncapi.yaml orderDataStream
id: orderDataStream
title: Live order data of an instrument
description: >
  The first frame is `snapshot`: the instrument's rules (price and quantity
  steps,

  `quantityUnit`, fees, leverage bounds), the account's settings for the

  instrument, its risk limits and the account's rebate rates. Then:


  - `buyingPower` - the buying power and total equity, whenever they
    change. Buying power is not part of the snapshot: it arrives with
    the first `buyingPower` frame, usually right after the snapshot;
  - `instrumentInfo`, `accountSettings`, `riskLimits` - a changed part,
    always complete: replace the part you hold;
  - `currencyRates` - conversion rates between assets;

  - `hmrLeverage` - Exness: the instrument's higher-margin window changed;

  - `error` - terminal; the socket is closed after it.


  `buyingPower` and `currencyRates` describe a current state: with

  `throttlingDelay` only the newest pending one of each is sent. The

  other frames are never merged or dropped.
servers:
  - id: production
    protocol: wss
    host: public-api.charting.com
    bindings: []
    variables: []
address: /api/v1/trading/order/data/stream
parameters: []
bindings:
  - protocol: ws
    version: 0.1.0
    value:
      method: GET
      query:
        type: object
        additionalProperties: false
        required:
          - accountId
          - exchange
          - symbol
        properties:
          accountId: &ref_0
            type: string
            minLength: 1
            description: >-
              Id of the exchange account (a UUID), as listed in `accountId` by
              /api/v1/trading/account/list. Not the account's title.
            example: 4b8e2f6a-91c3-4d57-a0e8-3f1c7b9d2e45
            x-parser-schema-id: AccountId
          connectorCode: &ref_1
            type: string
            description: >-
              Exchange connector of the account, as listed in `connectorCodes`
              by /api/v1/trading/account/list. Required when the account has
              more than one connector.
            example: binance_usdm
            x-parser-schema-id: ConnectorCode
          exchange: &ref_2
            type: string
            example: CXBNCE
            x-parser-schema-id: ExchangeCode
          symbol: &ref_3
            type: string
            example: BTC/USDT
            x-parser-schema-id: SecuritySymbol
          throttlingDelay:
            type: integer
            minimum: 0
            maximum: 60000
            description: >-
              Minimum milliseconds between two `buyingPower` frames, and between
              two `currencyRates` frames; only the newest pending one is kept.
    schemaProperties:
      - name: method
        type: string
        description: GET
        required: false
      - name: query
        type: object
        required: false
        properties:
          - name: accountId
            type: string
            description: >-
              Id of the exchange account (a UUID), as listed in `accountId` by
              /api/v1/trading/account/list. Not the account's title.
            required: true
          - name: connectorCode
            type: string
            description: >-
              Exchange connector of the account, as listed in `connectorCodes`
              by /api/v1/trading/account/list. Required when the account has
              more than one connector.
            required: false
          - name: exchange
            type: string
            required: true
          - name: symbol
            type: string
            required: true
          - name: throttlingDelay
            type: integer
            description: >-
              Minimum milliseconds between two `buyingPower` frames, and between
              two `currencyRates` frames; only the newest pending one is kept.
            required: false
operations:
  - &ref_12
    id: receiveOrderDataStream
    title: Receive order data stream
    type: receive
    messages:
      - &ref_13
        id: snapshot
        contentType: application/json
        payload:
          - name: Order data snapshot
            type: object
            properties:
              - name: type
                type: string
                description: snapshot
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: accountId
                type: string
                description: >-
                  Id of the exchange account (a UUID), as listed in `accountId`
                  by /api/v1/trading/account/list. Not the account's title.
                required: true
              - name: connectorCode
                type: string
                description: >-
                  Exchange connector of the account, as listed in
                  `connectorCodes` by /api/v1/trading/account/list. Required
                  when the account has more than one connector.
                required: false
              - name: instrument
                type: object
                required: true
                properties:
                  - name: exchange
                    type: string
                    required: true
                  - name: symbol
                    type: string
                    required: true
              - name: instrumentInfo
                type: object
                required: true
                properties:
                  - name: baseAsset
                    type: string
                    required: true
                  - name: quoteAsset
                    type: string
                    required: true
                  - name: quantityUnit
                    type: string
                    description: >-
                      Unit of `quantity`, of a position's `size` and of
                      `quantity` bounds. `lots` are the exchange's lots of
                      `contractSize` base-asset units each.
                    enumValues:
                      - baseAsset
                      - lots
                      - quoteAsset
                    required: true
                  - name: marketType
                    type: string
                    enumValues:
                      - spot
                      - perpetual
                      - cfd
                    required: true
                  - name: contractType
                    type: string
                    enumValues:
                      - linear
                      - inverse
                    required: false
                  - name: price
                    type: object
                    required: true
                    properties:
                      - name: min
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: max
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: step
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: quantity
                    type: object
                    required: true
                    properties:
                      - name: min
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: max
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: step
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: maxMarketQuantity
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: cost
                    type: object
                    required: false
                    properties:
                      - name: min
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: max
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: step
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: contractSize
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: leverage
                    type: object
                    required: false
                    properties:
                      - name: min
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: max
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: step
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: fees
                    type: object
                    required: false
                    properties:
                      - name: taker
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: maker
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: marginTradingAvailable
                    type: boolean
                    required: false
                  - name: marginTradingEnabled
                    type: boolean
                    required: false
                  - name: slippage
                    type: object
                    required: false
                    properties:
                      - name: priceSteps
                        type: object
                        required: false
                        properties:
                          - name: min
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: max
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: step
                            type: string
                            description: Decimal number as a string.
                            required: false
                      - name: percent
                        type: object
                        required: false
                        properties:
                          - name: min
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: max
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: step
                            type: string
                            description: Decimal number as a string.
                            required: false
                  - name: trailingStop
                    type: object
                    description: >
                      Bounds of a `percent` trailing-stop distance, by the side
                      from which

                      the price reaches the activation price; without an
                      activation price

                      `risesTo` applies to a buy and `fallsTo` to a sell. Absent
                      when the

                      instrument does not accept trailing-stop orders.
                    required: false
                    properties:
                      - name: risesTo
                        type: object
                        required: false
                        properties:
                          - name: min
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: max
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: step
                            type: string
                            description: Decimal number as a string.
                            required: false
                      - name: fallsTo
                        type: object
                        required: false
                        properties:
                          - name: min
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: max
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: step
                            type: string
                            description: Decimal number as a string.
                            required: false
                      - name: percentStep
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: exnessCommissions
                    type: object
                    description: >
                      Exness commission schedule of the account on the
                      instrument, in

                      place of `fees`. Empty `tiers` means the commission is in
                      the

                      spread. Absent where the exchange charges a percentage
                      (`fees`).
                    required: false
                    properties:
                      - name: tiers
                        type: array
                        required: false
                        properties:
                          - name: value
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: volumeFrom
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: volumeTo
                            type: string
                            description: Absent on the last, unbounded tier.
                            required: false
                      - name: currency
                        type: string
                        description: >-
                          Currency of every tier value; not necessarily the
                          quote asset.
                        required: false
                      - name: basis
                        type: string
                        enumValues:
                          - perLot
                          - perMillionTurnover
                        required: false
                      - name: charge
                        type: string
                        description: >-
                          `bothSidesOnOpen` - the value applies to each side and
                          both are charged at open; `roundTurn` - the value is
                          the whole charge.
                        enumValues:
                          - bothSidesOnOpen
                          - roundTurn
                        required: false
                  - name: leverageControl
                    type: object
                    description: >-
                      How the instrument's leverage can be shown and changed.
                      Absent means unknown.
                    required: false
                    properties:
                      - name: mode
                        type: string
                        enumValues:
                          - none
                          - readOnly
                          - editable
                        required: false
                      - name: reason
                        type: string
                        description: For `readOnly` only.
                        enumValues:
                          - fixedByInstrument
                          - controlledByAccount
                        required: false
                      - name: description
                        type: string
                        required: false
                  - name: swap
                    type: object
                    description: >-
                      Exness overnight swap, charged (negative) or paid for each
                      rollover a position is held over. Absent when the exchange
                      reports none.
                    required: false
                    properties:
                      - name: perLotLong
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: perLotShort
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: currency
                        type: string
                        required: false
                      - name: dayMultipliers
                        type: array
                        required: false
                        properties:
                          - name: day
                            type: string
                            enumValues:
                              - monday
                              - tuesday
                              - wednesday
                              - thursday
                              - friday
                              - saturday
                              - sunday
                            required: false
                          - name: multiplier
                            type: integer
                            description: >-
                              Nights a rollover on this day charges (3 for the
                              one covering the weekend).
                            required: false
              - name: accountSettings
                type: object
                required: true
                properties:
                  - name: positionMode
                    type: string
                    enumValues:
                      - oneWay
                      - hedge
                    required: false
                  - name: marginMode
                    type: string
                    enumValues:
                      - cross
                      - isolated
                      - portfolio
                    required: false
                  - name: leverageBuy
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: leverageSell
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: exchangeSpecific
                    type: object
                    description: Fields only one exchange reports.
                    required: false
                    properties:
                      - name: exness
                        type: object
                        required: false
                        properties:
                          - name: hmrLeveragePeriod
                            type: object
                            description: >-
                              The window in force, or else the nearest upcoming
                              one. While it is in force
                              `leverageBuy`/`leverageSell` carry its leverage.
                            required: false
                            properties:
                              - name: start
                                type: string
                                required: false
                              - name: end
                                type: string
                                required: false
                              - name: periodId
                                type: string
                                description: >-
                                  The exchange's id of the window; the same id
                                  across updates is the same window, possibly
                                  with moved bounds.
                                required: false
                              - name: effectiveLeverage
                                type: string
                                description: >-
                                  Leverage applied to what is opened during the
                                  window.
                                required: false
              - name: riskLimits
                type: object
                description: Derivatives only.
                required: false
                properties:
                  - name: initialMarginRate
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: maintenanceMarginRate
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: positionLimit
                    type: string
                    description: Decimal number as a string.
                    required: false
              - name: userRebateRate
                type: string
                description: Snapshot only; fixed for the subscription.
                required: false
              - name: totalRebateRate
                type: string
                description: Snapshot only; fixed for the subscription.
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - accountId
            - instrument
            - instrumentInfo
            - accountSettings
          properties:
            type:
              type: string
              const: snapshot
              x-parser-schema-id: <anonymous-schema-181>
            seq: &ref_6
              type: integer
              format: int64
              minimum: 1
              description: >-
                Number of the data frame within this connection, starting at 1
                with the snapshot.
              x-parser-schema-id: Seq
            accountId: *ref_0
            connectorCode: *ref_1
            instrument:
              type: object
              required:
                - exchange
                - symbol
              properties:
                exchange: *ref_2
                symbol: *ref_3
              x-parser-schema-id: Instrument
            instrumentInfo: &ref_8
              type: object
              required:
                - baseAsset
                - quoteAsset
                - marketType
                - quantityUnit
                - price
                - quantity
              properties:
                baseAsset:
                  type: string
                  x-parser-schema-id: <anonymous-schema-182>
                quoteAsset:
                  type: string
                  x-parser-schema-id: <anonymous-schema-183>
                quantityUnit:
                  type: string
                  enum:
                    - baseAsset
                    - lots
                    - quoteAsset
                  description: >-
                    Unit of `quantity`, of a position's `size` and of `quantity`
                    bounds. `lots` are the exchange's lots of `contractSize`
                    base-asset units each.
                  x-parser-schema-id: QuantityUnit
                marketType:
                  type: string
                  enum:
                    - spot
                    - perpetual
                    - cfd
                  x-parser-schema-id: <anonymous-schema-184>
                contractType:
                  type: string
                  enum:
                    - linear
                    - inverse
                  x-parser-schema-id: <anonymous-schema-185>
                price: &ref_5
                  type: object
                  properties:
                    min: &ref_4
                      type: string
                      pattern: ^-?[0-9]+(\.[0-9]+)?$
                      description: Decimal number as a string.
                      example: '0.001'
                      x-parser-schema-id: Decimal
                    max: *ref_4
                    step: *ref_4
                  x-parser-schema-id: DecimalBounds
                quantity: *ref_5
                maxMarketQuantity: *ref_4
                cost: *ref_5
                contractSize: *ref_4
                leverage: *ref_5
                fees:
                  type: object
                  properties:
                    taker: *ref_4
                    maker: *ref_4
                  x-parser-schema-id: <anonymous-schema-186>
                marginTradingAvailable:
                  type: boolean
                  x-parser-schema-id: <anonymous-schema-187>
                marginTradingEnabled:
                  type: boolean
                  x-parser-schema-id: <anonymous-schema-188>
                slippage:
                  type: object
                  properties:
                    priceSteps: *ref_5
                    percent: *ref_5
                  x-parser-schema-id: <anonymous-schema-189>
                trailingStop:
                  type: object
                  description: >
                    Bounds of a `percent` trailing-stop distance, by the side
                    from which

                    the price reaches the activation price; without an
                    activation price

                    `risesTo` applies to a buy and `fallsTo` to a sell. Absent
                    when the

                    instrument does not accept trailing-stop orders.
                  properties:
                    risesTo: *ref_5
                    fallsTo: *ref_5
                    percentStep: *ref_4
                  x-parser-schema-id: <anonymous-schema-190>
                exnessCommissions:
                  type: object
                  description: >
                    Exness commission schedule of the account on the instrument,
                    in

                    place of `fees`. Empty `tiers` means the commission is in
                    the

                    spread. Absent where the exchange charges a percentage
                    (`fees`).
                  properties:
                    tiers:
                      type: array
                      items:
                        type: object
                        properties:
                          value: *ref_4
                          volumeFrom: *ref_4
                          volumeTo:
                            allOf:
                              - *ref_4
                            description: Absent on the last, unbounded tier.
                            x-parser-schema-id: <anonymous-schema-194>
                        x-parser-schema-id: <anonymous-schema-193>
                      x-parser-schema-id: <anonymous-schema-192>
                    currency:
                      type: string
                      description: >-
                        Currency of every tier value; not necessarily the quote
                        asset.
                      x-parser-schema-id: <anonymous-schema-195>
                    basis:
                      type: string
                      enum:
                        - perLot
                        - perMillionTurnover
                      x-parser-schema-id: <anonymous-schema-196>
                    charge:
                      type: string
                      enum:
                        - bothSidesOnOpen
                        - roundTurn
                      description: >-
                        `bothSidesOnOpen` - the value applies to each side and
                        both are charged at open; `roundTurn` - the value is the
                        whole charge.
                      x-parser-schema-id: <anonymous-schema-197>
                  x-parser-schema-id: <anonymous-schema-191>
                leverageControl:
                  type: object
                  description: >-
                    How the instrument's leverage can be shown and changed.
                    Absent means unknown.
                  properties:
                    mode:
                      type: string
                      enum:
                        - none
                        - readOnly
                        - editable
                      x-parser-schema-id: <anonymous-schema-199>
                    reason:
                      type: string
                      enum:
                        - fixedByInstrument
                        - controlledByAccount
                      description: For `readOnly` only.
                      x-parser-schema-id: <anonymous-schema-200>
                    description:
                      type: string
                      x-parser-schema-id: <anonymous-schema-201>
                  x-parser-schema-id: <anonymous-schema-198>
                swap:
                  type: object
                  description: >-
                    Exness overnight swap, charged (negative) or paid for each
                    rollover a position is held over. Absent when the exchange
                    reports none.
                  properties:
                    perLotLong: *ref_4
                    perLotShort: *ref_4
                    currency:
                      type: string
                      x-parser-schema-id: <anonymous-schema-203>
                    dayMultipliers:
                      type: array
                      items:
                        type: object
                        properties:
                          day:
                            type: string
                            enum:
                              - monday
                              - tuesday
                              - wednesday
                              - thursday
                              - friday
                              - saturday
                              - sunday
                            x-parser-schema-id: <anonymous-schema-206>
                          multiplier:
                            type: integer
                            description: >-
                              Nights a rollover on this day charges (3 for the
                              one covering the weekend).
                            x-parser-schema-id: <anonymous-schema-207>
                        x-parser-schema-id: <anonymous-schema-205>
                      x-parser-schema-id: <anonymous-schema-204>
                  x-parser-schema-id: <anonymous-schema-202>
              x-parser-schema-id: InstrumentInfo
            accountSettings: &ref_9
              type: object
              properties:
                positionMode:
                  type: string
                  enum:
                    - oneWay
                    - hedge
                  x-parser-schema-id: PositionMode
                marginMode:
                  type: string
                  enum:
                    - cross
                    - isolated
                    - portfolio
                  x-parser-schema-id: <anonymous-schema-208>
                leverageBuy: *ref_4
                leverageSell: *ref_4
                exchangeSpecific:
                  type: object
                  description: Fields only one exchange reports.
                  properties:
                    exness:
                      type: object
                      properties:
                        hmrLeveragePeriod:
                          allOf:
                            - &ref_11
                              type: object
                              description: >
                                Higher margin requirements (Exness): a window in
                                which the exchange caps

                                the leverage of what is opened, for example
                                around news releases.
                              properties:
                                start:
                                  type: string
                                  format: date-time
                                  x-parser-schema-id: <anonymous-schema-65>
                                end:
                                  type: string
                                  format: date-time
                                  x-parser-schema-id: <anonymous-schema-66>
                                periodId:
                                  type: string
                                  description: >-
                                    The exchange's id of the window; the same id
                                    across updates is the same window, possibly
                                    with moved bounds.
                                  x-parser-schema-id: <anonymous-schema-67>
                                effectiveLeverage:
                                  allOf:
                                    - *ref_4
                                  description: >-
                                    Leverage applied to what is opened during
                                    the window.
                                  x-parser-schema-id: <anonymous-schema-68>
                              x-parser-schema-id: HmrLeveragePeriod
                          description: >-
                            The window in force, or else the nearest upcoming
                            one. While it is in force
                            `leverageBuy`/`leverageSell` carry its leverage.
                          x-parser-schema-id: <anonymous-schema-211>
                      x-parser-schema-id: <anonymous-schema-210>
                  x-parser-schema-id: <anonymous-schema-209>
              x-parser-schema-id: AccountSettings
            riskLimits: &ref_10
              type: object
              description: Derivatives only.
              properties:
                initialMarginRate: *ref_4
                maintenanceMarginRate: *ref_4
                positionLimit: *ref_4
              x-parser-schema-id: RiskLimits
            userRebateRate:
              allOf:
                - *ref_4
              description: Snapshot only; fixed for the subscription.
              x-parser-schema-id: <anonymous-schema-212>
            totalRebateRate:
              allOf:
                - *ref_4
              description: Snapshot only; fixed for the subscription.
              x-parser-schema-id: <anonymous-schema-213>
          x-parser-schema-id: <anonymous-schema-180>
        title: Order data snapshot
        example: |-
          {
            "type": "snapshot",
            "seq": 1,
            "accountId": "4b8e2f6a-91c3-4d57-a0e8-3f1c7b9d2e45",
            "connectorCode": "binance_usdm",
            "instrument": {
              "exchange": "CXBNCE",
              "symbol": "BTC/USDT"
            },
            "instrumentInfo": {
              "baseAsset": "BTC",
              "quoteAsset": "USDT",
              "quantityUnit": "baseAsset",
              "marketType": "perpetual",
              "contractType": "linear",
              "price": {
                "min": "0.1",
                "max": "1000000",
                "step": "0.1"
              },
              "quantity": {
                "min": "0.001",
                "max": "1000",
                "step": "0.001"
              }
            },
            "accountSettings": {
              "positionMode": "oneWay",
              "marginMode": "cross",
              "leverageBuy": "10",
              "leverageSell": "10"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: snapshot
      - &ref_14
        id: buyingPower
        contentType: application/json
        payload:
          - name: Buying power changed
            type: object
            properties:
              - name: type
                type: string
                description: buyingPower
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: buy
                type: object
                required: false
                properties:
                  - name: asset
                    type: string
                    required: true
                  - name: margin
                    type: string
                    description: Amount that can be traded, with leverage or borrowing.
                    required: true
                  - name: available
                    type: string
                    description: Spot only. Amount that can be traded from own funds.
                    required: false
              - name: sell
                type: object
                required: false
                properties:
                  - name: asset
                    type: string
                    required: true
                  - name: margin
                    type: string
                    description: Amount that can be traded, with leverage or borrowing.
                    required: true
                  - name: available
                    type: string
                    description: Spot only. Amount that can be traded from own funds.
                    required: false
              - name: totalEquity
                type: string
                description: Decimal number as a string.
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
          properties:
            type:
              type: string
              const: buyingPower
              x-parser-schema-id: <anonymous-schema-215>
            seq: *ref_6
            buy: &ref_7
              type: object
              required:
                - asset
                - margin
              properties:
                asset:
                  type: string
                  x-parser-schema-id: <anonymous-schema-216>
                margin:
                  allOf:
                    - *ref_4
                  description: Amount that can be traded, with leverage or borrowing.
                  x-parser-schema-id: <anonymous-schema-217>
                available:
                  allOf:
                    - *ref_4
                  description: Spot only. Amount that can be traded from own funds.
                  x-parser-schema-id: <anonymous-schema-218>
              x-parser-schema-id: BuyingPowerSide
            sell: *ref_7
            totalEquity: *ref_4
          x-parser-schema-id: <anonymous-schema-214>
        title: Buying power changed
        example: |-
          {
            "type": "buyingPower",
            "seq": 2,
            "buy": {
              "asset": "USDT",
              "margin": "12500"
            },
            "sell": {
              "asset": "USDT",
              "margin": "12500"
            },
            "totalEquity": "12650.40"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: buyingPower
      - &ref_15
        id: instrumentInfo
        contentType: application/json
        payload:
          - name: Instrument rules changed
            type: object
            properties:
              - name: type
                type: string
                description: instrumentInfo
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: instrumentInfo
                type: object
                required: true
                properties:
                  - name: baseAsset
                    type: string
                    required: true
                  - name: quoteAsset
                    type: string
                    required: true
                  - name: quantityUnit
                    type: string
                    description: >-
                      Unit of `quantity`, of a position's `size` and of
                      `quantity` bounds. `lots` are the exchange's lots of
                      `contractSize` base-asset units each.
                    enumValues:
                      - baseAsset
                      - lots
                      - quoteAsset
                    required: true
                  - name: marketType
                    type: string
                    enumValues:
                      - spot
                      - perpetual
                      - cfd
                    required: true
                  - name: contractType
                    type: string
                    enumValues:
                      - linear
                      - inverse
                    required: false
                  - name: price
                    type: object
                    required: true
                    properties:
                      - name: min
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: max
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: step
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: quantity
                    type: object
                    required: true
                    properties:
                      - name: min
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: max
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: step
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: maxMarketQuantity
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: cost
                    type: object
                    required: false
                    properties:
                      - name: min
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: max
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: step
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: contractSize
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: leverage
                    type: object
                    required: false
                    properties:
                      - name: min
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: max
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: step
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: fees
                    type: object
                    required: false
                    properties:
                      - name: taker
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: maker
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: marginTradingAvailable
                    type: boolean
                    required: false
                  - name: marginTradingEnabled
                    type: boolean
                    required: false
                  - name: slippage
                    type: object
                    required: false
                    properties:
                      - name: priceSteps
                        type: object
                        required: false
                        properties:
                          - name: min
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: max
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: step
                            type: string
                            description: Decimal number as a string.
                            required: false
                      - name: percent
                        type: object
                        required: false
                        properties:
                          - name: min
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: max
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: step
                            type: string
                            description: Decimal number as a string.
                            required: false
                  - name: trailingStop
                    type: object
                    description: >
                      Bounds of a `percent` trailing-stop distance, by the side
                      from which

                      the price reaches the activation price; without an
                      activation price

                      `risesTo` applies to a buy and `fallsTo` to a sell. Absent
                      when the

                      instrument does not accept trailing-stop orders.
                    required: false
                    properties:
                      - name: risesTo
                        type: object
                        required: false
                        properties:
                          - name: min
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: max
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: step
                            type: string
                            description: Decimal number as a string.
                            required: false
                      - name: fallsTo
                        type: object
                        required: false
                        properties:
                          - name: min
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: max
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: step
                            type: string
                            description: Decimal number as a string.
                            required: false
                      - name: percentStep
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: exnessCommissions
                    type: object
                    description: >
                      Exness commission schedule of the account on the
                      instrument, in

                      place of `fees`. Empty `tiers` means the commission is in
                      the

                      spread. Absent where the exchange charges a percentage
                      (`fees`).
                    required: false
                    properties:
                      - name: tiers
                        type: array
                        required: false
                        properties:
                          - name: value
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: volumeFrom
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: volumeTo
                            type: string
                            description: Absent on the last, unbounded tier.
                            required: false
                      - name: currency
                        type: string
                        description: >-
                          Currency of every tier value; not necessarily the
                          quote asset.
                        required: false
                      - name: basis
                        type: string
                        enumValues:
                          - perLot
                          - perMillionTurnover
                        required: false
                      - name: charge
                        type: string
                        description: >-
                          `bothSidesOnOpen` - the value applies to each side and
                          both are charged at open; `roundTurn` - the value is
                          the whole charge.
                        enumValues:
                          - bothSidesOnOpen
                          - roundTurn
                        required: false
                  - name: leverageControl
                    type: object
                    description: >-
                      How the instrument's leverage can be shown and changed.
                      Absent means unknown.
                    required: false
                    properties:
                      - name: mode
                        type: string
                        enumValues:
                          - none
                          - readOnly
                          - editable
                        required: false
                      - name: reason
                        type: string
                        description: For `readOnly` only.
                        enumValues:
                          - fixedByInstrument
                          - controlledByAccount
                        required: false
                      - name: description
                        type: string
                        required: false
                  - name: swap
                    type: object
                    description: >-
                      Exness overnight swap, charged (negative) or paid for each
                      rollover a position is held over. Absent when the exchange
                      reports none.
                    required: false
                    properties:
                      - name: perLotLong
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: perLotShort
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: currency
                        type: string
                        required: false
                      - name: dayMultipliers
                        type: array
                        required: false
                        properties:
                          - name: day
                            type: string
                            enumValues:
                              - monday
                              - tuesday
                              - wednesday
                              - thursday
                              - friday
                              - saturday
                              - sunday
                            required: false
                          - name: multiplier
                            type: integer
                            description: >-
                              Nights a rollover on this day charges (3 for the
                              one covering the weekend).
                            required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - instrumentInfo
          properties:
            type:
              type: string
              const: instrumentInfo
              x-parser-schema-id: <anonymous-schema-220>
            seq: *ref_6
            instrumentInfo: *ref_8
          x-parser-schema-id: <anonymous-schema-219>
        title: Instrument rules changed
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: instrumentInfo
      - &ref_16
        id: accountSettings
        contentType: application/json
        payload:
          - name: Account settings changed
            type: object
            properties:
              - name: type
                type: string
                description: accountSettings
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: accountSettings
                type: object
                required: true
                properties:
                  - name: positionMode
                    type: string
                    enumValues:
                      - oneWay
                      - hedge
                    required: false
                  - name: marginMode
                    type: string
                    enumValues:
                      - cross
                      - isolated
                      - portfolio
                    required: false
                  - name: leverageBuy
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: leverageSell
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: exchangeSpecific
                    type: object
                    description: Fields only one exchange reports.
                    required: false
                    properties:
                      - name: exness
                        type: object
                        required: false
                        properties:
                          - name: hmrLeveragePeriod
                            type: object
                            description: >-
                              The window in force, or else the nearest upcoming
                              one. While it is in force
                              `leverageBuy`/`leverageSell` carry its leverage.
                            required: false
                            properties:
                              - name: start
                                type: string
                                required: false
                              - name: end
                                type: string
                                required: false
                              - name: periodId
                                type: string
                                description: >-
                                  The exchange's id of the window; the same id
                                  across updates is the same window, possibly
                                  with moved bounds.
                                required: false
                              - name: effectiveLeverage
                                type: string
                                description: >-
                                  Leverage applied to what is opened during the
                                  window.
                                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - accountSettings
          properties:
            type:
              type: string
              const: accountSettings
              x-parser-schema-id: <anonymous-schema-222>
            seq: *ref_6
            accountSettings: *ref_9
          x-parser-schema-id: <anonymous-schema-221>
        title: Account settings changed
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: accountSettings
      - &ref_17
        id: riskLimits
        contentType: application/json
        payload:
          - name: Risk limits changed
            type: object
            properties:
              - name: type
                type: string
                description: riskLimits
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: riskLimits
                type: object
                description: Derivatives only.
                required: true
                properties:
                  - name: initialMarginRate
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: maintenanceMarginRate
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: positionLimit
                    type: string
                    description: Decimal number as a string.
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - riskLimits
          properties:
            type:
              type: string
              const: riskLimits
              x-parser-schema-id: <anonymous-schema-224>
            seq: *ref_6
            riskLimits: *ref_10
          x-parser-schema-id: <anonymous-schema-223>
        title: Risk limits changed
        example: |-
          {
            "type": "<string>",
            "seq": 123,
            "riskLimits": {
              "initialMarginRate": "<string>",
              "maintenanceMarginRate": "<string>",
              "positionLimit": "<string>"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: riskLimits
      - &ref_18
        id: currencyRates
        contentType: application/json
        payload:
          - name: Currency rates
            type: object
            properties:
              - name: type
                type: string
                description: currencyRates
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: rates
                type: array
                required: true
                properties:
                  - name: baseAsset
                    type: string
                    required: true
                  - name: quoteAsset
                    type: string
                    required: true
                  - name: rate
                    type: string
                    description: Decimal number as a string.
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - rates
          properties:
            type:
              type: string
              const: currencyRates
              x-parser-schema-id: <anonymous-schema-226>
            seq: *ref_6
            rates:
              type: array
              items:
                type: object
                required:
                  - baseAsset
                  - quoteAsset
                  - rate
                properties:
                  baseAsset:
                    type: string
                    x-parser-schema-id: <anonymous-schema-229>
                  quoteAsset:
                    type: string
                    x-parser-schema-id: <anonymous-schema-230>
                  rate: *ref_4
                x-parser-schema-id: <anonymous-schema-228>
              x-parser-schema-id: <anonymous-schema-227>
          x-parser-schema-id: <anonymous-schema-225>
        title: Currency rates
        example: |-
          {
            "type": "currencyRates",
            "seq": 3,
            "rates": [
              {
                "baseAsset": "USDT",
                "quoteAsset": "USD",
                "rate": "0.9998"
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: currencyRates
      - &ref_19
        id: hmrLeverage
        contentType: application/json
        payload:
          - name: Higher margin window changed
            description: >
              Exness: the higher-margin window of the instrument changed (a new
              or

              moved window, the one in force ended, or the account leverage

              changed). `period` absent means no window is known any more. A
              change

              that moves the leverage also sends `accountSettings`.
            type: object
            properties:
              - name: type
                type: string
                description: hmrLeverage
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: period
                type: object
                description: >
                  Higher margin requirements (Exness): a window in which the
                  exchange caps

                  the leverage of what is opened, for example around news
                  releases.
                required: false
                properties:
                  - name: start
                    type: string
                    required: false
                  - name: end
                    type: string
                    required: false
                  - name: periodId
                    type: string
                    description: >-
                      The exchange's id of the window; the same id across
                      updates is the same window, possibly with moved bounds.
                    required: false
                  - name: effectiveLeverage
                    type: string
                    description: Leverage applied to what is opened during the window.
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
          properties:
            type:
              type: string
              const: hmrLeverage
              x-parser-schema-id: <anonymous-schema-232>
            seq: *ref_6
            period: *ref_11
          x-parser-schema-id: <anonymous-schema-231>
        title: Higher margin window changed
        description: |
          Exness: the higher-margin window of the instrument changed (a new or
          moved window, the one in force ended, or the account leverage
          changed). `period` absent means no window is known any more. A change
          that moves the leverage also sends `accountSettings`.
        example: |-
          {
            "type": "<string>",
            "seq": 123,
            "period": {
              "start": "<string>",
              "end": "<string>",
              "periodId": "<string>",
              "effectiveLeverage": "<string>"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: hmrLeverage
      - &ref_20
        id: error
        contentType: application/json
        payload:
          - name: Terminal error
            description: The stream is over; the socket is closed after this frame.
            type: object
            properties:
              - name: type
                type: string
                description: error
                required: true
              - name: error
                type: object
                required: true
                properties:
                  - name: code
                    type: string
                    description: >
                      `exchange_access_lost` - the exchange no longer accepts
                      the

                      account's API key (expired, revoked or invalid): reconnect
                      the

                      account in TakeProfit. `not_found` - the account or
                      connector

                      was removed. `permission_denied` - the API key was revoked
                      or

                      lost the scope `trading:access:write`. `slow_consumer` -
                      the

                      client did not read its frames fast enough. The others are

                      transient: reconnect after `retryAfter`.
                    enumValues:
                      - exchange_access_lost
                      - not_found
                      - permission_denied
                      - rate_limited
                      - slow_consumer
                      - unavailable
                      - bad_gateway
                      - deadline_exceeded
                    required: true
                  - name: message
                    type: string
                    required: true
                  - name: retryAfter
                    type: integer
                    description: >-
                      Seconds to wait before reconnecting, when the error is
                      transient.
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - error
          properties:
            type:
              type: string
              const: error
              x-parser-schema-id: <anonymous-schema-175>
            error:
              type: object
              required:
                - code
                - message
              properties:
                code:
                  type: string
                  description: >
                    `exchange_access_lost` - the exchange no longer accepts the

                    account's API key (expired, revoked or invalid): reconnect
                    the

                    account in TakeProfit. `not_found` - the account or
                    connector

                    was removed. `permission_denied` - the API key was revoked
                    or

                    lost the scope `trading:access:write`. `slow_consumer` - the

                    client did not read its frames fast enough. The others are

                    transient: reconnect after `retryAfter`.
                  enum:
                    - exchange_access_lost
                    - not_found
                    - permission_denied
                    - rate_limited
                    - slow_consumer
                    - unavailable
                    - bad_gateway
                    - deadline_exceeded
                  x-parser-schema-id: <anonymous-schema-177>
                message:
                  type: string
                  x-parser-schema-id: <anonymous-schema-178>
                retryAfter:
                  type: integer
                  description: >-
                    Seconds to wait before reconnecting, when the error is
                    transient.
                  x-parser-schema-id: <anonymous-schema-179>
              x-parser-schema-id: <anonymous-schema-176>
          x-parser-schema-id: <anonymous-schema-174>
        title: Terminal error
        description: The stream is over; the socket is closed after this frame.
        example: |-
          {
            "type": "error",
            "error": {
              "code": "rate_limited",
              "message": "quota exceeded"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: error
    bindings: []
    extensions:
      - id: x-parser-unique-object-id
        value: orderDataStream
sendOperations:
  - *ref_12
receiveOperations: []
sendMessages:
  - *ref_13
  - *ref_14
  - *ref_15
  - *ref_16
  - *ref_17
  - *ref_18
  - *ref_19
  - *ref_20
receiveMessages: []
extensions:
  - id: x-parser-unique-object-id
    value: orderDataStream
securitySchemes:
  - id: ApiKeyAuth
    name: X-API-KEY
    type: httpApiKey
    description: Your API key.
    in: header
    extensions: []
  - id: Timestamp
    name: X-API-TIMESTAMP
    type: httpApiKey
    description: Time of the upgrade request in Unix milliseconds.
    in: header
    extensions: []
  - id: Signature
    name: X-API-SIGNATURE
    type: httpApiKey
    description: >-
      Hex Ed25519 signature of timestamp + API key + receive window + raw query
      string.
    in: header
    extensions: []

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.