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

# Events stream

> Follow one exchange account live over WebSocket: a snapshot of its balances, working orders and positions, then a frame for every order change, fill, position and balance.

The events stream is how you see the outcome of every request you send over REST. Connect to `wss://public-api.charting.com/api/v1/trading/events/stream` with `accountId`, `connectorCode` when the account has more than one connector, and optionally `label` in the query string. Sign the handshake like a GET (see [Sign every request](https://takeprofit.com/docs/platform-api/trading/api-keys.md#sign-every-request)). After it, the client sends nothing.

## Frames

The first frame is a `snapshot`: the account totals, balances, working orders and open positions. Then a frame arrives for every change:

| Frame | Sent when |
| - | - |
| `order` | An order is placed, filled, partly filled, canceled or rejected. A final status (`filled`, `partiallyFilledClosed`, `rejected`, `canceled`, `closed`) means it's no longer working. |
| `execution` | A fill, a funding fee or another execution. Every fill comes as its own frame. |
| `position` | A position changed. `size` `"0"` means it closed. |
| `balance` | The totals or balances changed. |
| `commandError` | A request accepted with `202` then failed, in TakeProfit or at the exchange. The stream goes on. |
| `notification` | The outcome of a request or an account event: an order placed, rejected, amended or replaced, a bulk cancel, a position closed, reversed or protected. |
| `marginMode`, `spotMarginTrade` | The account's margin mode or spot margin trading changed. |
| `executionRebate` | Cashback set on a fill already delivered (Exness only for now). |
| `warning` | The connection to the exchange was interrupted, or data may have been missed. Reconnect to get a fresh `snapshot`. |
| `error` | The stream ended. The socket closes after it. |

* **`label` filters orders and fills**, and the snapshot's orders, to your script's orders. Positions and balances are account-wide and never filtered.
* **An amend can replace the order.** On a connector that can't amend in place, the amend cancels the order and places a new one. The `notification` frame has `order.kind` `replaced`, and the order continues under `order.replacementOrderId`: track the new id from then on.
* **`seq` orders the frames of one connection**, starting at 1 with the snapshot. After a reconnect, the new snapshot replaces everything you hold.

## Staying connected

* **Credits:** 25 from the streaming quota when the stream opens, and again in every 300-second window it stays open. If a window is already spent at renewal, the stream ends with an `error` frame `rate_limited`.
* **At most 5 trading streams** per account, across all keys.
* **The key is rechecked** at least every 5 minutes. A revoked or expired key ends the stream with `permission_denied`.
* **Pings:** the server pings every 30 seconds and closes the connection if no pong arrives within 5 seconds.
* **Read fast enough.** A client that falls behind is disconnected with `slow_consumer` rather than slowing the account's stream.
* **After an `error` frame, the stream is over.** Reconnecting opens a new, newly charged subscription. Wait at least `retryAfter` seconds when the frame has it.


## AsyncAPI

````yaml platform-api/specs/trading-asyncapi.yaml eventsStream
id: eventsStream
title: Live trading events
description: |
  On subscription the stream sends a `snapshot` of the account, then a
  frame for every change of its orders, executions, positions and
  balances.

  `label` narrows the `order` and `execution` frames, and the orders of
  the snapshot, to your orders; positions and balances are account-wide
  and not filtered.
servers:
  - id: production
    protocol: wss
    host: public-api.charting.com
    bindings: []
    variables: []
address: /api/v1/trading/events/stream
parameters: []
bindings:
  - protocol: ws
    version: 0.1.0
    value:
      method: GET
      query:
        type: object
        additionalProperties: false
        required:
          - accountId
        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
          label:
            type: string
            description: >-
              Comma-separated labels. Only orders and executions carrying one of
              them are sent.
    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: label
            type: string
            description: >-
              Comma-separated labels. Only orders and executions carrying one of
              them are sent.
            required: false
operations:
  - &ref_20
    id: receiveEventsStream
    title: Receive events stream
    type: receive
    messages:
      - &ref_21
        id: snapshot
        contentType: application/json
        payload:
          - name: Account 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: totals
                type: object
                description: Account-wide figures, in the account's valuation currency.
                required: false
                properties:
                  - name: equity
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: availableBalance
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: perpetualUnrealizedPnl
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: initialMargin
                    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: accountId
                            type: string
                            required: false
                          - name: currency
                            type: string
                            required: false
                          - name: leverage
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: tradeMode
                            type: string
                            required: false
                          - name: accountStatus
                            type: string
                            required: false
                          - name: executionMode
                            type: string
                            required: false
              - name: exchangeSpecific
                type: object
                description: Fields only one exchange reports.
                required: false
                properties:
                  - name: bybit
                    type: object
                    required: false
                    properties:
                      - name: marginMode
                        type: string
                        enumValues:
                          - cross
                          - isolated
                          - portfolio
                        required: false
              - name: balances
                type: array
                required: true
                properties:
                  - name: asset
                    type: string
                    required: true
                  - name: equity
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: walletBalance
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: availableBalance
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: unrealizedPnl
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: usdValue
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: collateral
                    type: boolean
                    required: false
                  - name: exchangeSpecific
                    type: object
                    description: Fields only one exchange reports.
                    required: false
                    properties:
                      - name: bybit
                        type: object
                        required: false
                        properties:
                          - name: borrowed
                            type: string
                            description: >-
                              Borrowed for margin trading (spot margin
                              accounts).
                            required: false
                          - name: spotBorrow
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: accruedInterest
                            type: string
                            description: Decimal number as a string.
                            required: false
              - name: openOrders
                type: array
                required: true
                properties:
                  - name: orderId
                    type: string
                    required: true
                  - name: exchangeOrderId
                    type: string
                    required: false
                  - name: instrument
                    type: object
                    required: true
                    properties:
                      - name: exchange
                        type: string
                        required: true
                      - name: symbol
                        type: string
                        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: label
                    type: string
                    required: false
                  - name: side
                    type: string
                    enumValues:
                      - buy
                      - sell
                    required: true
                  - name: kind
                    type: string
                    description: >-
                      What the order does. `other` is a kind this API version
                      does not describe; `exchangeOrderType` then names it.
                    enumValues:
                      - market
                      - limit
                      - takeProfitMarket
                      - takeProfitLimit
                      - stopLossMarket
                      - stopLossLimit
                      - conditionalMarket
                      - conditionalLimit
                      - tpsl
                      - trailingStopMarket
                      - trailingStopLimit
                      - other
                    required: true
                  - name: exchangeOrderType
                    type: string
                    description: The exchange's own order type, when `kind` is `other`.
                    required: false
                  - name: stopOrderType
                    type: string
                    enumValues:
                      - takeProfit
                      - stopLoss
                      - trailingStop
                      - stop
                      - partialTakeProfit
                      - partialStopLoss
                      - tpslOrder
                      - ocoOrder
                      - bidirectionalTpslOrder
                      - mmRateClose
                      - trailingProfit
                    required: false
                  - name: status
                    type: string
                    enumValues:
                      - accepted
                      - placed
                      - pending
                      - partiallyFilled
                      - filled
                      - partiallyFilledClosed
                      - rejected
                      - canceled
                      - closed
                    required: true
                  - name: quantity
                    type: string
                    description: Decimal number as a string.
                    required: true
                  - name: cumExecQuantity
                    type: string
                    description: Decimal number as a string.
                    required: true
                  - name: cumExecValue
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: price
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: avgPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: timeInForce
                    type: string
                    enumValues:
                      - gtc
                      - ioc
                      - fok
                    required: false
                  - name: reduceOnly
                    type: boolean
                    required: false
                  - name: positionSide
                    type: string
                    description: >-
                      Side of the position the order belongs to. `both` - a
                      one-way position (Binance USD-M).
                    enumValues:
                      - long
                      - short
                      - both
                    required: false
                  - name: positionId
                    type: string
                    description: Id of the position the order belongs to. Absent for spot.
                    required: false
                  - name: triggerPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: triggerDirection
                    type: string
                    enumValues:
                      - risesTo
                      - fallsTo
                    required: false
                  - name: trailingStop
                    type: object
                    description: Present only for a trailing-stop order.
                    required: false
                    properties:
                      - name: distance
                        type: object
                        required: false
                        properties:
                          - name: price
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: percent
                            type: string
                            description: Decimal number as a string.
                            required: false
                      - name: activation
                        type: object
                        required: false
                        properties:
                          - name: price
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: direction
                            type: string
                            enumValues:
                              - risesTo
                              - fallsTo
                            required: false
                      - name: triggerBy
                        type: string
                        enumValues:
                          - lastPrice
                          - markPrice
                          - indexPrice
                        required: false
                  - name: takeProfit
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: stopLoss
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: tpLimitPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: slLimitPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: leavesValue
                    type: string
                    description: >-
                      The notional still working, in the quote currency. Zero
                      once the order is closed.
                    required: false
                  - name: parentOrderId
                    type: string
                    description: The order a take-profit/stop-loss leg was spawned from.
                    required: false
                  - name: tpSlLeg
                    type: object
                    description: >-
                      Present when the order is a position take-profit/stop-loss
                      leg.
                    required: false
                    properties:
                      - name: pairId
                        type: string
                        description: >-
                          Both legs of one pair carry it; `pairId` of
                          /api/v1/trading/position/add-tpsl.
                        required: false
                      - name: pairCreatedAt
                        type: string
                        required: false
                  - name: createdAt
                    type: string
                    required: false
                  - name: exchangeCreatedAt
                    type: string
                    description: Absent until the exchange acknowledges the order.
                    required: false
                  - name: updatedAt
                    type: string
                    required: false
                  - name: exchangeSpecific
                    type: object
                    description: Fields only one exchange reports. At most one arm is set.
                    required: false
                    properties:
                      - name: bybit
                        type: object
                        required: false
                        properties:
                          - name: cumExecFee
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: tpslMode
                            type: string
                            required: false
                          - name: triggerBy
                            type: string
                            enumValues:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            required: false
                          - name: tpTriggerBy
                            type: string
                            enumValues:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            required: false
                          - name: slTriggerBy
                            type: string
                            enumValues:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            required: false
                      - name: binanceSpot
                        type: object
                        required: false
                        properties:
                          - name: orderListId
                            type: string
                            description: >-
                              Id of the OCO/OTO/OTOCO list the order is a leg
                              of. Cancelling any leg cancels the whole list.
                            required: false
                          - name: waitsForWorkingOrder
                            type: boolean
                            description: >-
                              A pending leg of an OTO/OTOCO list whose working
                              order has not filled yet.
                            required: false
                      - name: exness
                        type: object
                        required: false
                        properties:
                          - name: exnessOrderType
                            type: string
                            required: false
                          - name: reason
                            type: string
                            required: false
                          - name: eventId
                            type: string
                            required: false
                          - name: operationId
                            type: string
                            required: false
                          - name: parentOperationId
                            type: string
                            required: false
                          - name: clientRequestId
                            type: string
                            required: false
                          - name: transactionStatus
                            type: string
                            required: false
              - name: positions
                type: array
                required: true
                properties:
                  - name: instrument
                    type: object
                    required: true
                    properties:
                      - name: exchange
                        type: string
                        required: true
                      - name: symbol
                        type: string
                        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: marketType
                    type: string
                    enumValues:
                      - spot
                      - perpetual
                      - cfd
                    required: false
                  - name: contractType
                    type: string
                    enumValues:
                      - linear
                      - inverse
                    required: false
                  - name: side
                    type: string
                    description: >-
                      Absent on a closed position whose side the exchange no
                      longer reports (Bybit one-way).
                    enumValues:
                      - long
                      - short
                      - both
                    required: false
                  - name: positionId
                    type: string
                    description: >
                      Id of the position, stable across closes. Name the
                      position by it

                      in `/position/close` and `/position/add-tpsl`.
                    required: false
                  - name: positionMode
                    type: string
                    enumValues:
                      - oneWay
                      - hedge
                    required: false
                  - name: size
                    type: string
                    description: Decimal number as a string.
                    required: true
                  - name: positionValue
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: avgPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: markPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: currentPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: liqPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: unrealizedPnl
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: unrealizedPnlPercent
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: initialMargin
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: maintenanceMargin
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: leverage
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: updatedAt
                    type: string
                    required: false
                  - name: exchangeSpecific
                    type: object
                    description: Fields only one exchange reports. At most one arm is set.
                    required: false
                    properties:
                      - name: bybit
                        type: object
                        required: false
                        properties:
                          - name: createdTime
                            type: string
                            required: false
                          - name: takeProfit
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: stopLoss
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: trailingStop
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: cumRealisedPnl
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: curRealisedPnl
                            type: string
                            description: Decimal number as a string.
                            required: false
                      - name: exness
                        type: object
                        required: false
                        properties:
                          - name: state
                            type: string
                            required: false
                          - name: initialVolume
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: marginRate
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: commission
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: swap
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: createTime
                            type: string
                            required: false
                          - name: rolloverTime
                            type: string
                            required: false
                          - name: hmrLeveragePeriod
                            type: object
                            description: >-
                              The window in force, or else the nearest upcoming
                              one. A position opened before the window keeps its
                              regular margin.
                            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
            - accountId
            - balances
            - openOrders
            - positions
          properties:
            type:
              type: string
              const: snapshot
              x-parser-schema-id: <anonymous-schema-2>
            seq: &ref_5
              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
            totals: &ref_12
              type: object
              description: Account-wide figures, in the account's valuation currency.
              properties:
                equity: &ref_2
                  type: string
                  pattern: ^-?[0-9]+(\.[0-9]+)?$
                  description: Decimal number as a string.
                  example: '0.001'
                  x-parser-schema-id: Decimal
                availableBalance: *ref_2
                perpetualUnrealizedPnl: *ref_2
                initialMargin: *ref_2
                exchangeSpecific:
                  type: object
                  description: Fields only one exchange reports.
                  properties:
                    exness:
                      type: object
                      properties:
                        accountId:
                          type: string
                          x-parser-schema-id: <anonymous-schema-5>
                        currency:
                          type: string
                          x-parser-schema-id: <anonymous-schema-6>
                        leverage: *ref_2
                        tradeMode:
                          type: string
                          x-parser-schema-id: <anonymous-schema-7>
                        accountStatus:
                          type: string
                          x-parser-schema-id: <anonymous-schema-8>
                        executionMode:
                          type: string
                          x-parser-schema-id: <anonymous-schema-9>
                      x-parser-schema-id: <anonymous-schema-4>
                  x-parser-schema-id: <anonymous-schema-3>
              x-parser-schema-id: Totals
            exchangeSpecific:
              type: object
              description: Fields only one exchange reports.
              properties:
                bybit:
                  type: object
                  properties:
                    marginMode: &ref_19
                      type: string
                      enum:
                        - cross
                        - isolated
                        - portfolio
                      x-parser-schema-id: MarginMode
                  x-parser-schema-id: <anonymous-schema-11>
              x-parser-schema-id: <anonymous-schema-10>
            balances:
              type: array
              items: &ref_13
                type: object
                required:
                  - asset
                properties:
                  asset:
                    type: string
                    x-parser-schema-id: <anonymous-schema-13>
                  equity: *ref_2
                  walletBalance: *ref_2
                  availableBalance: *ref_2
                  unrealizedPnl: *ref_2
                  usdValue: *ref_2
                  collateral:
                    type: boolean
                    x-parser-schema-id: <anonymous-schema-14>
                  exchangeSpecific:
                    type: object
                    description: Fields only one exchange reports.
                    properties:
                      bybit:
                        type: object
                        properties:
                          borrowed:
                            allOf:
                              - *ref_2
                            description: >-
                              Borrowed for margin trading (spot margin
                              accounts).
                            x-parser-schema-id: <anonymous-schema-17>
                          spotBorrow: *ref_2
                          accruedInterest: *ref_2
                        x-parser-schema-id: <anonymous-schema-16>
                    x-parser-schema-id: <anonymous-schema-15>
                x-parser-schema-id: Balance
              x-parser-schema-id: <anonymous-schema-12>
            openOrders:
              type: array
              items: &ref_6
                type: object
                required:
                  - orderId
                  - instrument
                  - side
                  - kind
                  - status
                  - quantity
                  - cumExecQuantity
                properties:
                  orderId:
                    type: string
                    x-parser-schema-id: <anonymous-schema-19>
                  exchangeOrderId:
                    type: string
                    x-parser-schema-id: <anonymous-schema-20>
                  instrument: &ref_4
                    type: object
                    required:
                      - exchange
                      - symbol
                    properties:
                      exchange:
                        type: string
                        example: CXBNCE
                        x-parser-schema-id: ExchangeCode
                      symbol:
                        type: string
                        example: BTC/USDT
                        x-parser-schema-id: SecuritySymbol
                    x-parser-schema-id: Instrument
                  connectorCode: *ref_1
                  label: &ref_7
                    type: string
                    example: grid-btc-1
                    x-parser-schema-id: Label
                  side: &ref_8
                    type: string
                    enum:
                      - buy
                      - sell
                    x-parser-schema-id: Side
                  kind: &ref_9
                    type: string
                    description: >-
                      What the order does. `other` is a kind this API version
                      does not describe; `exchangeOrderType` then names it.
                    enum:
                      - market
                      - limit
                      - takeProfitMarket
                      - takeProfitLimit
                      - stopLossMarket
                      - stopLossLimit
                      - conditionalMarket
                      - conditionalLimit
                      - tpsl
                      - trailingStopMarket
                      - trailingStopLimit
                      - other
                    x-parser-schema-id: OrderKind
                  exchangeOrderType:
                    type: string
                    description: The exchange's own order type, when `kind` is `other`.
                    x-parser-schema-id: <anonymous-schema-21>
                  stopOrderType: &ref_10
                    type: string
                    enum:
                      - takeProfit
                      - stopLoss
                      - trailingStop
                      - stop
                      - partialTakeProfit
                      - partialStopLoss
                      - tpslOrder
                      - ocoOrder
                      - bidirectionalTpslOrder
                      - mmRateClose
                      - trailingProfit
                    x-parser-schema-id: StopOrderType
                  status:
                    type: string
                    enum:
                      - accepted
                      - placed
                      - pending
                      - partiallyFilled
                      - filled
                      - partiallyFilledClosed
                      - rejected
                      - canceled
                      - closed
                    x-parser-schema-id: <anonymous-schema-22>
                  quantity: *ref_2
                  cumExecQuantity: *ref_2
                  cumExecValue: *ref_2
                  price: *ref_2
                  avgPrice: *ref_2
                  timeInForce:
                    type: string
                    enum:
                      - gtc
                      - ioc
                      - fok
                    x-parser-schema-id: <anonymous-schema-23>
                  reduceOnly:
                    type: boolean
                    x-parser-schema-id: <anonymous-schema-24>
                  positionSide:
                    type: string
                    enum:
                      - long
                      - short
                      - both
                    description: >-
                      Side of the position the order belongs to. `both` - a
                      one-way position (Binance USD-M).
                    x-parser-schema-id: <anonymous-schema-25>
                  positionId:
                    type: string
                    description: Id of the position the order belongs to. Absent for spot.
                    x-parser-schema-id: <anonymous-schema-26>
                  triggerPrice: *ref_2
                  triggerDirection:
                    type: string
                    enum:
                      - risesTo
                      - fallsTo
                    x-parser-schema-id: <anonymous-schema-27>
                  trailingStop:
                    allOf:
                      - &ref_18
                        type: object
                        description: >-
                          Same shape as `order.trailingStop` of
                          /api/v1/trading/order/create.
                        properties:
                          distance:
                            type: object
                            properties:
                              price: *ref_2
                              percent: *ref_2
                            x-parser-schema-id: <anonymous-schema-29>
                          activation:
                            type: object
                            properties:
                              price: *ref_2
                              direction:
                                type: string
                                enum:
                                  - risesTo
                                  - fallsTo
                                x-parser-schema-id: TriggerDirection
                            x-parser-schema-id: <anonymous-schema-30>
                          triggerBy: &ref_3
                            type: string
                            enum:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            x-parser-schema-id: TriggerBy
                        x-parser-schema-id: TrailingStop
                    description: Present only for a trailing-stop order.
                    x-parser-schema-id: <anonymous-schema-28>
                  takeProfit: *ref_2
                  stopLoss: *ref_2
                  tpLimitPrice: *ref_2
                  slLimitPrice: *ref_2
                  leavesValue:
                    allOf:
                      - *ref_2
                    description: >-
                      The notional still working, in the quote currency. Zero
                      once the order is closed.
                    x-parser-schema-id: <anonymous-schema-31>
                  parentOrderId:
                    type: string
                    description: The order a take-profit/stop-loss leg was spawned from.
                    x-parser-schema-id: <anonymous-schema-32>
                  tpSlLeg:
                    type: object
                    description: >-
                      Present when the order is a position take-profit/stop-loss
                      leg.
                    properties:
                      pairId:
                        type: string
                        description: >-
                          Both legs of one pair carry it; `pairId` of
                          /api/v1/trading/position/add-tpsl.
                        x-parser-schema-id: <anonymous-schema-34>
                      pairCreatedAt:
                        type: string
                        format: date-time
                        x-parser-schema-id: <anonymous-schema-35>
                    x-parser-schema-id: <anonymous-schema-33>
                  createdAt:
                    type: string
                    format: date-time
                    x-parser-schema-id: <anonymous-schema-36>
                  exchangeCreatedAt:
                    type: string
                    format: date-time
                    description: Absent until the exchange acknowledges the order.
                    x-parser-schema-id: <anonymous-schema-37>
                  updatedAt:
                    type: string
                    format: date-time
                    x-parser-schema-id: <anonymous-schema-38>
                  exchangeSpecific:
                    type: object
                    description: Fields only one exchange reports. At most one arm is set.
                    properties:
                      bybit:
                        type: object
                        properties:
                          cumExecFee: *ref_2
                          tpslMode:
                            type: string
                            x-parser-schema-id: <anonymous-schema-40>
                          triggerBy: *ref_3
                          tpTriggerBy: *ref_3
                          slTriggerBy: *ref_3
                        x-parser-schema-id: <anonymous-schema-39>
                      binanceSpot:
                        type: object
                        properties:
                          orderListId:
                            type: string
                            description: >-
                              Id of the OCO/OTO/OTOCO list the order is a leg
                              of. Cancelling any leg cancels the whole list.
                            x-parser-schema-id: <anonymous-schema-42>
                          waitsForWorkingOrder:
                            type: boolean
                            description: >-
                              A pending leg of an OTO/OTOCO list whose working
                              order has not filled yet.
                            x-parser-schema-id: <anonymous-schema-43>
                        x-parser-schema-id: <anonymous-schema-41>
                      exness:
                        type: object
                        properties:
                          exnessOrderType:
                            type: string
                            x-parser-schema-id: <anonymous-schema-45>
                          reason:
                            type: string
                            x-parser-schema-id: <anonymous-schema-46>
                          eventId:
                            type: string
                            x-parser-schema-id: <anonymous-schema-47>
                          operationId:
                            type: string
                            x-parser-schema-id: <anonymous-schema-48>
                          parentOperationId:
                            type: string
                            x-parser-schema-id: <anonymous-schema-49>
                          clientRequestId:
                            type: string
                            x-parser-schema-id: <anonymous-schema-50>
                          transactionStatus:
                            type: string
                            x-parser-schema-id: <anonymous-schema-51>
                        x-parser-schema-id: <anonymous-schema-44>
                    x-parser-schema-id: OrderExchangeSpecific
                x-parser-schema-id: Order
              x-parser-schema-id: <anonymous-schema-18>
            positions:
              type: array
              items: &ref_11
                type: object
                required:
                  - instrument
                  - size
                properties:
                  instrument: *ref_4
                  connectorCode: *ref_1
                  marketType:
                    type: string
                    enum:
                      - spot
                      - perpetual
                      - cfd
                    x-parser-schema-id: <anonymous-schema-53>
                  contractType:
                    type: string
                    enum:
                      - linear
                      - inverse
                    x-parser-schema-id: <anonymous-schema-54>
                  side:
                    type: string
                    enum:
                      - long
                      - short
                      - both
                    description: >-
                      Absent on a closed position whose side the exchange no
                      longer reports (Bybit one-way).
                    x-parser-schema-id: <anonymous-schema-55>
                  positionId:
                    type: string
                    description: >
                      Id of the position, stable across closes. Name the
                      position by it

                      in `/position/close` and `/position/add-tpsl`.
                    x-parser-schema-id: <anonymous-schema-56>
                  positionMode:
                    type: string
                    enum:
                      - oneWay
                      - hedge
                    x-parser-schema-id: PositionMode
                  size: *ref_2
                  positionValue: *ref_2
                  avgPrice: *ref_2
                  markPrice: *ref_2
                  currentPrice: *ref_2
                  liqPrice: *ref_2
                  unrealizedPnl: *ref_2
                  unrealizedPnlPercent: *ref_2
                  initialMargin: *ref_2
                  maintenanceMargin: *ref_2
                  leverage: *ref_2
                  updatedAt:
                    type: string
                    format: date-time
                    x-parser-schema-id: <anonymous-schema-57>
                  exchangeSpecific:
                    type: object
                    description: Fields only one exchange reports. At most one arm is set.
                    properties:
                      bybit:
                        type: object
                        properties:
                          createdTime:
                            type: string
                            format: date-time
                            x-parser-schema-id: <anonymous-schema-59>
                          takeProfit: *ref_2
                          stopLoss: *ref_2
                          trailingStop: *ref_2
                          cumRealisedPnl: *ref_2
                          curRealisedPnl: *ref_2
                        x-parser-schema-id: <anonymous-schema-58>
                      exness:
                        type: object
                        properties:
                          state:
                            type: string
                            x-parser-schema-id: <anonymous-schema-61>
                          initialVolume: *ref_2
                          marginRate: *ref_2
                          commission: *ref_2
                          swap: *ref_2
                          createTime:
                            type: string
                            x-parser-schema-id: <anonymous-schema-62>
                          rolloverTime:
                            type: string
                            x-parser-schema-id: <anonymous-schema-63>
                          hmrLeveragePeriod:
                            allOf:
                              - 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_2
                                    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. A position opened before the window keeps its
                              regular margin.
                            x-parser-schema-id: <anonymous-schema-64>
                        x-parser-schema-id: <anonymous-schema-60>
                    x-parser-schema-id: PositionExchangeSpecific
                x-parser-schema-id: Position
              x-parser-schema-id: <anonymous-schema-52>
          x-parser-schema-id: <anonymous-schema-1>
        title: Account snapshot
        example: |-
          {
            "type": "snapshot",
            "seq": 1,
            "accountId": "4b8e2f6a-91c3-4d57-a0e8-3f1c7b9d2e45",
            "connectorCode": "binance_usdm",
            "totals": {
              "equity": "12500.00",
              "availableBalance": "11900.00"
            },
            "balances": [
              {
                "asset": "USDT",
                "equity": "12500.00",
                "walletBalance": "12500.00",
                "availableBalance": "11900.00"
              }
            ],
            "openOrders": [
              {
                "orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
                "exchangeOrderId": "8389765521",
                "instrument": {
                  "exchange": "CXBNCE",
                  "symbol": "BTC/USDT"
                },
                "connectorCode": "binance_usdm",
                "label": "grid-btc-1",
                "side": "buy",
                "kind": "limit",
                "status": "placed",
                "quantity": "0.001",
                "cumExecQuantity": "0",
                "price": "60000",
                "timeInForce": "gtc",
                "createdAt": "2026-11-20T10:15:00Z",
                "updatedAt": "2026-11-20T10:15:01Z"
              }
            ],
            "positions": []
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: snapshot
      - &ref_22
        id: order
        contentType: application/json
        payload:
          - name: Order changed
            type: object
            properties:
              - name: type
                type: string
                description: order
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: order
                type: object
                required: true
                properties:
                  - name: orderId
                    type: string
                    required: true
                  - name: exchangeOrderId
                    type: string
                    required: false
                  - name: instrument
                    type: object
                    required: true
                    properties:
                      - name: exchange
                        type: string
                        required: true
                      - name: symbol
                        type: string
                        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: label
                    type: string
                    required: false
                  - name: side
                    type: string
                    enumValues:
                      - buy
                      - sell
                    required: true
                  - name: kind
                    type: string
                    description: >-
                      What the order does. `other` is a kind this API version
                      does not describe; `exchangeOrderType` then names it.
                    enumValues:
                      - market
                      - limit
                      - takeProfitMarket
                      - takeProfitLimit
                      - stopLossMarket
                      - stopLossLimit
                      - conditionalMarket
                      - conditionalLimit
                      - tpsl
                      - trailingStopMarket
                      - trailingStopLimit
                      - other
                    required: true
                  - name: exchangeOrderType
                    type: string
                    description: The exchange's own order type, when `kind` is `other`.
                    required: false
                  - name: stopOrderType
                    type: string
                    enumValues:
                      - takeProfit
                      - stopLoss
                      - trailingStop
                      - stop
                      - partialTakeProfit
                      - partialStopLoss
                      - tpslOrder
                      - ocoOrder
                      - bidirectionalTpslOrder
                      - mmRateClose
                      - trailingProfit
                    required: false
                  - name: status
                    type: string
                    enumValues:
                      - accepted
                      - placed
                      - pending
                      - partiallyFilled
                      - filled
                      - partiallyFilledClosed
                      - rejected
                      - canceled
                      - closed
                    required: true
                  - name: quantity
                    type: string
                    description: Decimal number as a string.
                    required: true
                  - name: cumExecQuantity
                    type: string
                    description: Decimal number as a string.
                    required: true
                  - name: cumExecValue
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: price
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: avgPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: timeInForce
                    type: string
                    enumValues:
                      - gtc
                      - ioc
                      - fok
                    required: false
                  - name: reduceOnly
                    type: boolean
                    required: false
                  - name: positionSide
                    type: string
                    description: >-
                      Side of the position the order belongs to. `both` - a
                      one-way position (Binance USD-M).
                    enumValues:
                      - long
                      - short
                      - both
                    required: false
                  - name: positionId
                    type: string
                    description: Id of the position the order belongs to. Absent for spot.
                    required: false
                  - name: triggerPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: triggerDirection
                    type: string
                    enumValues:
                      - risesTo
                      - fallsTo
                    required: false
                  - name: trailingStop
                    type: object
                    description: Present only for a trailing-stop order.
                    required: false
                    properties:
                      - name: distance
                        type: object
                        required: false
                        properties:
                          - name: price
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: percent
                            type: string
                            description: Decimal number as a string.
                            required: false
                      - name: activation
                        type: object
                        required: false
                        properties:
                          - name: price
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: direction
                            type: string
                            enumValues:
                              - risesTo
                              - fallsTo
                            required: false
                      - name: triggerBy
                        type: string
                        enumValues:
                          - lastPrice
                          - markPrice
                          - indexPrice
                        required: false
                  - name: takeProfit
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: stopLoss
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: tpLimitPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: slLimitPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: leavesValue
                    type: string
                    description: >-
                      The notional still working, in the quote currency. Zero
                      once the order is closed.
                    required: false
                  - name: parentOrderId
                    type: string
                    description: The order a take-profit/stop-loss leg was spawned from.
                    required: false
                  - name: tpSlLeg
                    type: object
                    description: >-
                      Present when the order is a position take-profit/stop-loss
                      leg.
                    required: false
                    properties:
                      - name: pairId
                        type: string
                        description: >-
                          Both legs of one pair carry it; `pairId` of
                          /api/v1/trading/position/add-tpsl.
                        required: false
                      - name: pairCreatedAt
                        type: string
                        required: false
                  - name: createdAt
                    type: string
                    required: false
                  - name: exchangeCreatedAt
                    type: string
                    description: Absent until the exchange acknowledges the order.
                    required: false
                  - name: updatedAt
                    type: string
                    required: false
                  - name: exchangeSpecific
                    type: object
                    description: Fields only one exchange reports. At most one arm is set.
                    required: false
                    properties:
                      - name: bybit
                        type: object
                        required: false
                        properties:
                          - name: cumExecFee
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: tpslMode
                            type: string
                            required: false
                          - name: triggerBy
                            type: string
                            enumValues:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            required: false
                          - name: tpTriggerBy
                            type: string
                            enumValues:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            required: false
                          - name: slTriggerBy
                            type: string
                            enumValues:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            required: false
                      - name: binanceSpot
                        type: object
                        required: false
                        properties:
                          - name: orderListId
                            type: string
                            description: >-
                              Id of the OCO/OTO/OTOCO list the order is a leg
                              of. Cancelling any leg cancels the whole list.
                            required: false
                          - name: waitsForWorkingOrder
                            type: boolean
                            description: >-
                              A pending leg of an OTO/OTOCO list whose working
                              order has not filled yet.
                            required: false
                      - name: exness
                        type: object
                        required: false
                        properties:
                          - name: exnessOrderType
                            type: string
                            required: false
                          - name: reason
                            type: string
                            required: false
                          - name: eventId
                            type: string
                            required: false
                          - name: operationId
                            type: string
                            required: false
                          - name: parentOperationId
                            type: string
                            required: false
                          - name: clientRequestId
                            type: string
                            required: false
                          - name: transactionStatus
                            type: string
                            required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - order
          properties:
            type:
              type: string
              const: order
              x-parser-schema-id: <anonymous-schema-70>
            seq: *ref_5
            order: *ref_6
          x-parser-schema-id: <anonymous-schema-69>
        title: Order changed
        example: |-
          {
            "type": "order",
            "seq": 2,
            "order": {
              "orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
              "exchangeOrderId": "8389765521",
              "instrument": {
                "exchange": "CXBNCE",
                "symbol": "BTC/USDT"
              },
              "connectorCode": "binance_usdm",
              "label": "grid-btc-1",
              "side": "buy",
              "kind": "limit",
              "status": "filled",
              "quantity": "0.001",
              "cumExecQuantity": "0.001",
              "cumExecValue": "60.00",
              "price": "60000",
              "avgPrice": "60000",
              "timeInForce": "gtc",
              "createdAt": "2026-11-20T10:15:00Z",
              "updatedAt": "2026-11-20T10:21:44Z"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: order
      - &ref_23
        id: execution
        contentType: application/json
        payload:
          - name: Execution
            type: object
            properties:
              - name: type
                type: string
                description: execution
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: execution
                type: object
                required: true
                properties:
                  - name: execId
                    type: string
                    description: >-
                      The exchange's id of the execution. Deduplicate fills by
                      it.
                    required: true
                  - name: orderId
                    type: string
                    description: TakeProfit id of the order the execution belongs to.
                    required: true
                  - name: exchangeOrderId
                    type: string
                    required: false
                  - name: instrument
                    type: object
                    required: true
                    properties:
                      - name: exchange
                        type: string
                        required: true
                      - name: symbol
                        type: string
                        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: label
                    type: string
                    required: false
                  - name: side
                    type: string
                    enumValues:
                      - buy
                      - sell
                    required: true
                  - name: execType
                    type: string
                    description: >-
                      A regular fill is `trade`; the others are funding fees,
                      auto-deleveraging, liquidation, settlement and delivery
                      executions.
                    enumValues:
                      - trade
                      - funding
                      - adlTrade
                      - bustTrade
                      - settle
                      - delivery
                      - blockTrade
                    required: true
                  - name: execPrice
                    type: string
                    description: Decimal number as a string.
                    required: true
                  - name: execQuantity
                    type: string
                    description: Decimal number as a string.
                    required: true
                  - name: execValue
                    type: string
                    description: Executed value in `quoteCurrency`.
                    required: false
                  - name: quoteCurrency
                    type: string
                    required: false
                  - name: execFee
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: feeCurrency
                    type: string
                    required: false
                  - name: feeRate
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: isMaker
                    type: boolean
                    required: false
                  - name: execPnl
                    type: string
                    description: Realized PnL of this execution.
                    required: false
                  - name: execTime
                    type: string
                    required: true
                  - name: valueUsdt
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: userRebateUsdt
                    type: string
                    description: Can arrive later in an `executionRebate` frame.
                    required: false
                  - name: orderKind
                    type: string
                    description: >-
                      What the order does. `other` is a kind this API version
                      does not describe; `exchangeOrderType` then names it.
                    enumValues:
                      - market
                      - limit
                      - takeProfitMarket
                      - takeProfitLimit
                      - stopLossMarket
                      - stopLossLimit
                      - conditionalMarket
                      - conditionalLimit
                      - tpsl
                      - trailingStopMarket
                      - trailingStopLimit
                      - other
                    required: false
                  - name: exchangeOrderType
                    type: string
                    required: false
                  - name: exchangeSpecific
                    type: object
                    description: Fields only one exchange reports. At most one arm is set.
                    required: false
                    properties:
                      - name: bybit
                        type: object
                        required: false
                        properties:
                          - name: markPrice
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: closedSize
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: orderType
                            type: string
                            enumValues:
                              - market
                              - limit
                            required: false
                          - name: stopOrderType
                            type: string
                            enumValues:
                              - takeProfit
                              - stopLoss
                              - trailingStop
                              - stop
                              - partialTakeProfit
                              - partialStopLoss
                              - tpslOrder
                              - ocoOrder
                              - bidirectionalTpslOrder
                              - mmRateClose
                              - trailingProfit
                            required: false
                      - name: binanceSpot
                        type: object
                        required: false
                        properties:
                          - name: orderType
                            type: string
                            enumValues:
                              - market
                              - limit
                            required: false
                      - name: binanceUsdm
                        type: object
                        required: false
                        properties:
                          - name: orderType
                            type: string
                            enumValues:
                              - market
                              - limit
                            required: false
                      - name: exness
                        type: object
                        required: false
                        properties:
                          - name: dealType
                            type: string
                            required: false
                          - name: positionId
                            type: string
                            required: false
                          - name: profitCurrency
                            type: string
                            description: Currency of `execPnl`.
                            required: false
                          - name: orderType
                            type: string
                            enumValues:
                              - market
                              - limit
                            required: false
                          - name: openSpread
                            type: string
                            description: >-
                              In pips; Zero and Raw Spread accounts of partner
                              keys only.
                            required: false
                          - name: closeSpread
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: eventId
                            type: string
                            required: false
                          - name: operationId
                            type: string
                            required: false
                          - name: parentOperationId
                            type: string
                            required: false
                          - name: clientRequestId
                            type: string
                            required: false
                          - name: transactionStatus
                            type: string
                            required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - execution
          properties:
            type:
              type: string
              const: execution
              x-parser-schema-id: <anonymous-schema-72>
            seq: *ref_5
            execution:
              type: object
              required:
                - execId
                - orderId
                - instrument
                - side
                - execType
                - execPrice
                - execQuantity
                - execTime
              properties:
                execId:
                  type: string
                  description: The exchange's id of the execution. Deduplicate fills by it.
                  x-parser-schema-id: <anonymous-schema-73>
                orderId:
                  type: string
                  description: TakeProfit id of the order the execution belongs to.
                  x-parser-schema-id: <anonymous-schema-74>
                exchangeOrderId:
                  type: string
                  x-parser-schema-id: <anonymous-schema-75>
                instrument: *ref_4
                connectorCode: *ref_1
                label: *ref_7
                side: *ref_8
                execType:
                  type: string
                  enum:
                    - trade
                    - funding
                    - adlTrade
                    - bustTrade
                    - settle
                    - delivery
                    - blockTrade
                  description: >-
                    A regular fill is `trade`; the others are funding fees,
                    auto-deleveraging, liquidation, settlement and delivery
                    executions.
                  x-parser-schema-id: <anonymous-schema-76>
                execPrice: *ref_2
                execQuantity: *ref_2
                execValue:
                  allOf:
                    - *ref_2
                  description: Executed value in `quoteCurrency`.
                  x-parser-schema-id: <anonymous-schema-77>
                quoteCurrency:
                  type: string
                  x-parser-schema-id: <anonymous-schema-78>
                execFee: *ref_2
                feeCurrency:
                  type: string
                  x-parser-schema-id: <anonymous-schema-79>
                feeRate: *ref_2
                isMaker:
                  type: boolean
                  x-parser-schema-id: <anonymous-schema-80>
                execPnl:
                  allOf:
                    - *ref_2
                  description: Realized PnL of this execution.
                  x-parser-schema-id: <anonymous-schema-81>
                execTime:
                  type: string
                  format: date-time
                  x-parser-schema-id: <anonymous-schema-82>
                valueUsdt: *ref_2
                userRebateUsdt:
                  allOf:
                    - *ref_2
                  description: Can arrive later in an `executionRebate` frame.
                  x-parser-schema-id: <anonymous-schema-83>
                orderKind: *ref_9
                exchangeOrderType:
                  type: string
                  x-parser-schema-id: <anonymous-schema-84>
                exchangeSpecific:
                  type: object
                  description: Fields only one exchange reports. At most one arm is set.
                  properties:
                    bybit:
                      type: object
                      properties:
                        markPrice: *ref_2
                        closedSize: *ref_2
                        orderType:
                          type: string
                          enum:
                            - market
                            - limit
                          x-parser-schema-id: <anonymous-schema-86>
                        stopOrderType: *ref_10
                      x-parser-schema-id: <anonymous-schema-85>
                    binanceSpot:
                      type: object
                      properties:
                        orderType:
                          type: string
                          enum:
                            - market
                            - limit
                          x-parser-schema-id: <anonymous-schema-88>
                      x-parser-schema-id: <anonymous-schema-87>
                    binanceUsdm:
                      type: object
                      properties:
                        orderType:
                          type: string
                          enum:
                            - market
                            - limit
                          x-parser-schema-id: <anonymous-schema-90>
                      x-parser-schema-id: <anonymous-schema-89>
                    exness:
                      type: object
                      properties:
                        dealType:
                          type: string
                          x-parser-schema-id: <anonymous-schema-92>
                        positionId:
                          type: string
                          x-parser-schema-id: <anonymous-schema-93>
                        profitCurrency:
                          type: string
                          description: Currency of `execPnl`.
                          x-parser-schema-id: <anonymous-schema-94>
                        orderType:
                          type: string
                          enum:
                            - market
                            - limit
                          x-parser-schema-id: <anonymous-schema-95>
                        openSpread:
                          allOf:
                            - *ref_2
                          description: >-
                            In pips; Zero and Raw Spread accounts of partner
                            keys only.
                          x-parser-schema-id: <anonymous-schema-96>
                        closeSpread: *ref_2
                        eventId:
                          type: string
                          x-parser-schema-id: <anonymous-schema-97>
                        operationId:
                          type: string
                          x-parser-schema-id: <anonymous-schema-98>
                        parentOperationId:
                          type: string
                          x-parser-schema-id: <anonymous-schema-99>
                        clientRequestId:
                          type: string
                          x-parser-schema-id: <anonymous-schema-100>
                        transactionStatus:
                          type: string
                          x-parser-schema-id: <anonymous-schema-101>
                      x-parser-schema-id: <anonymous-schema-91>
                  x-parser-schema-id: ExecutionExchangeSpecific
              x-parser-schema-id: Execution
          x-parser-schema-id: <anonymous-schema-71>
        title: Execution
        example: |-
          {
            "type": "execution",
            "seq": 3,
            "execution": {
              "execId": "e-5521-1",
              "orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
              "exchangeOrderId": "8389765521",
              "instrument": {
                "exchange": "CXBNCE",
                "symbol": "BTC/USDT"
              },
              "connectorCode": "binance_usdm",
              "label": "grid-btc-1",
              "side": "buy",
              "execType": "trade",
              "execPrice": "60000",
              "execQuantity": "0.001",
              "execValue": "60.00",
              "quoteCurrency": "USDT",
              "execFee": "0.012",
              "feeCurrency": "USDT",
              "isMaker": true,
              "execTime": "2026-11-20T10:21:44Z"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: execution
      - &ref_24
        id: position
        contentType: application/json
        payload:
          - name: Position changed
            type: object
            properties:
              - name: type
                type: string
                description: position
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: position
                type: object
                required: true
                properties:
                  - name: instrument
                    type: object
                    required: true
                    properties:
                      - name: exchange
                        type: string
                        required: true
                      - name: symbol
                        type: string
                        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: marketType
                    type: string
                    enumValues:
                      - spot
                      - perpetual
                      - cfd
                    required: false
                  - name: contractType
                    type: string
                    enumValues:
                      - linear
                      - inverse
                    required: false
                  - name: side
                    type: string
                    description: >-
                      Absent on a closed position whose side the exchange no
                      longer reports (Bybit one-way).
                    enumValues:
                      - long
                      - short
                      - both
                    required: false
                  - name: positionId
                    type: string
                    description: >
                      Id of the position, stable across closes. Name the
                      position by it

                      in `/position/close` and `/position/add-tpsl`.
                    required: false
                  - name: positionMode
                    type: string
                    enumValues:
                      - oneWay
                      - hedge
                    required: false
                  - name: size
                    type: string
                    description: Decimal number as a string.
                    required: true
                  - name: positionValue
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: avgPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: markPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: currentPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: liqPrice
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: unrealizedPnl
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: unrealizedPnlPercent
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: initialMargin
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: maintenanceMargin
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: leverage
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: updatedAt
                    type: string
                    required: false
                  - name: exchangeSpecific
                    type: object
                    description: Fields only one exchange reports. At most one arm is set.
                    required: false
                    properties:
                      - name: bybit
                        type: object
                        required: false
                        properties:
                          - name: createdTime
                            type: string
                            required: false
                          - name: takeProfit
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: stopLoss
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: trailingStop
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: cumRealisedPnl
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: curRealisedPnl
                            type: string
                            description: Decimal number as a string.
                            required: false
                      - name: exness
                        type: object
                        required: false
                        properties:
                          - name: state
                            type: string
                            required: false
                          - name: initialVolume
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: marginRate
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: commission
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: swap
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: createTime
                            type: string
                            required: false
                          - name: rolloverTime
                            type: string
                            required: false
                          - name: hmrLeveragePeriod
                            type: object
                            description: >-
                              The window in force, or else the nearest upcoming
                              one. A position opened before the window keeps its
                              regular margin.
                            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
            - position
          properties:
            type:
              type: string
              const: position
              x-parser-schema-id: <anonymous-schema-103>
            seq: *ref_5
            position: *ref_11
          x-parser-schema-id: <anonymous-schema-102>
        title: Position changed
        example: |-
          {
            "type": "position",
            "seq": 4,
            "position": {
              "instrument": {
                "exchange": "CXBNCE",
                "symbol": "BTC/USDT"
              },
              "connectorCode": "binance_usdm",
              "marketType": "perpetual",
              "contractType": "linear",
              "side": "long",
              "positionMode": "oneWay",
              "size": "0.001",
              "avgPrice": "60000",
              "markPrice": "60010",
              "unrealizedPnl": "0.01",
              "leverage": "10",
              "updatedAt": "2026-11-20T10:21:44Z"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: position
      - &ref_25
        id: balance
        contentType: application/json
        payload:
          - name: Balances changed
            type: object
            properties:
              - name: type
                type: string
                description: balance
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: totals
                type: object
                description: Account-wide figures, in the account's valuation currency.
                required: false
                properties:
                  - name: equity
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: availableBalance
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: perpetualUnrealizedPnl
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: initialMargin
                    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: accountId
                            type: string
                            required: false
                          - name: currency
                            type: string
                            required: false
                          - name: leverage
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: tradeMode
                            type: string
                            required: false
                          - name: accountStatus
                            type: string
                            required: false
                          - name: executionMode
                            type: string
                            required: false
              - name: balances
                type: array
                description: The balances that changed.
                required: true
                properties:
                  - name: asset
                    type: string
                    required: true
                  - name: equity
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: walletBalance
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: availableBalance
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: unrealizedPnl
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: usdValue
                    type: string
                    description: Decimal number as a string.
                    required: false
                  - name: collateral
                    type: boolean
                    required: false
                  - name: exchangeSpecific
                    type: object
                    description: Fields only one exchange reports.
                    required: false
                    properties:
                      - name: bybit
                        type: object
                        required: false
                        properties:
                          - name: borrowed
                            type: string
                            description: >-
                              Borrowed for margin trading (spot margin
                              accounts).
                            required: false
                          - name: spotBorrow
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: accruedInterest
                            type: string
                            description: Decimal number as a string.
                            required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - balances
          properties:
            type:
              type: string
              const: balance
              x-parser-schema-id: <anonymous-schema-105>
            seq: *ref_5
            totals: *ref_12
            balances:
              type: array
              description: The balances that changed.
              items: *ref_13
              x-parser-schema-id: <anonymous-schema-106>
          x-parser-schema-id: <anonymous-schema-104>
        title: Balances changed
        example: |-
          {
            "type": "balance",
            "seq": 5,
            "totals": {
              "equity": "12499.99",
              "availableBalance": "11893.99"
            },
            "balances": [
              {
                "asset": "USDT",
                "equity": "12499.99",
                "walletBalance": "12499.988",
                "availableBalance": "11893.99"
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: balance
      - &ref_26
        id: commandError
        contentType: application/json
        payload:
          - name: A request failed during processing
            description: |
              A request you sent over REST was accepted (202) for asynchronous
              processing but then failed, in TakeProfit or at the exchange. Not
              terminal: the stream continues.
            type: object
            properties:
              - name: type
                type: string
                description: commandError
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: orderId
                type: string
                description: The order the failed request was about, when it named one.
                required: false
              - name: code
                type: string
                enumValues:
                  - invalid_argument
                  - failed_precondition
                  - permission_denied
                  - not_found
                  - already_exists
                  - resource_exhausted
                  - unavailable
                  - deadline_exceeded
                  - internal
                required: true
              - name: message
                type: string
                description: Human-readable reason.
                required: true
              - name: exchangeError
                type: object
                description: The exchange's own error, when it returned one.
                required: false
                properties:
                  - name: code
                    type: string
                    required: false
                  - name: message
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - code
            - message
          properties:
            type:
              type: string
              const: commandError
              x-parser-schema-id: <anonymous-schema-108>
            seq: *ref_5
            orderId:
              type: string
              description: The order the failed request was about, when it named one.
              x-parser-schema-id: <anonymous-schema-109>
            code:
              type: string
              enum:
                - invalid_argument
                - failed_precondition
                - permission_denied
                - not_found
                - already_exists
                - resource_exhausted
                - unavailable
                - deadline_exceeded
                - internal
              x-parser-schema-id: <anonymous-schema-110>
            message:
              type: string
              description: Human-readable reason.
              x-parser-schema-id: <anonymous-schema-111>
            exchangeError:
              type: object
              description: The exchange's own error, when it returned one.
              properties:
                code:
                  type: string
                  x-parser-schema-id: <anonymous-schema-113>
                message:
                  type: string
                  x-parser-schema-id: <anonymous-schema-114>
              x-parser-schema-id: <anonymous-schema-112>
          x-parser-schema-id: <anonymous-schema-107>
        title: A request failed during processing
        description: |
          A request you sent over REST was accepted (202) for asynchronous
          processing but then failed, in TakeProfit or at the exchange. Not
          terminal: the stream continues.
        example: |-
          {
            "type": "commandError",
            "seq": 6,
            "orderId": "2a3b4c5d-6e7f-4809-9a1b-2c3d4e5f6a7b",
            "code": "failed_precondition",
            "message": "order rejected by the exchange",
            "exchangeError": {
              "code": "-2019",
              "message": "Margin is insufficient."
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: commandError
      - &ref_27
        id: notification
        contentType: application/json
        payload:
          - name: Notification
            description: |
              The outcome of a request you sent over REST (an order placed,
              rejected, amended or replaced; a bulk cancel; a position closed or
              protected) or an account event (a position closed or reversed, an
              execution, a higher margin window). Not terminal.
            type: object
            properties:
              - name: type
                type: string
                description: notification
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                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: notification
                type: object
                description: >
                  A notification about a request or an account event. Exactly
                  one of the

                  objects other than `timestamp` is set. A request outcome
                  carries

                  `message` when it failed.
                required: true
                properties:
                  - name: timestamp
                    type: string
                    required: false
                  - name: order
                    type: object
                    description: The outcome of an order request.
                    required: false
                    properties:
                      - name: kind
                        type: string
                        description: >
                          `replaced` - an amend on a connector that cannot amend
                          in place

                          (`replacesOrder`) cancelled the order and placed a new
                          one: the

                          order continues under `replacementOrderId`.
                          `failedReplace` - such

                          an amend did not apply and the order keeps its
                          previous parameters,

                          under `replacementOrderId` when it was re-placed.

                          `replaceStatusUnknown` - no verdict yet: watch both
                          ids.

                          `replaceOrderLost` - the old order was cancelled and
                          nothing could

                          be placed: no working order is left.
                        enumValues:
                          - placed
                          - failure
                          - rejected
                          - cancelled
                          - updated
                          - replaced
                          - failedReplace
                          - replaceStatusUnknown
                          - replaceOrderLost
                        required: true
                      - name: message
                        type: string
                        required: false
                      - name: orderId
                        type: string
                        description: The order the request was about.
                        required: false
                      - name: replacementOrderId
                        type: string
                        description: >-
                          The id the order continues under after a
                          cancel-and-place amend.
                        required: false
                      - name: instrument
                        type: object
                        required: false
                        properties:
                          - name: exchange
                            type: string
                            required: true
                          - name: symbol
                            type: string
                            required: true
                      - name: side
                        type: string
                        enumValues:
                          - buy
                          - sell
                        required: false
                      - name: orderType
                        type: string
                        enumValues:
                          - market
                          - limit
                        required: false
                      - name: orderKind
                        type: string
                        description: >-
                          What the order does. `other` is a kind this API
                          version does not describe; `exchangeOrderType` then
                          names it.
                        enumValues:
                          - market
                          - limit
                          - takeProfitMarket
                          - takeProfitLimit
                          - stopLossMarket
                          - stopLossLimit
                          - conditionalMarket
                          - conditionalLimit
                          - tpsl
                          - trailingStopMarket
                          - trailingStopLimit
                          - other
                        required: false
                      - name: exchangeOrderType
                        type: string
                        required: false
                      - name: quantity
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: limitPrice
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: triggerPrice
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: previousQuantity
                        type: string
                        description: >-
                          Before an amend; equal to `quantity` when the amend
                          did not apply.
                        required: false
                      - name: previousLimitPrice
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: previousTriggerPrice
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: tpSl
                        type: object
                        description: Present when the order is a take-profit/stop-loss leg.
                        required: false
                        properties:
                          - name: kind
                            type: string
                            enumValues:
                              - takeProfit
                              - stopLoss
                              - spotBracket
                              - takeProfitStopLoss
                            required: false
                          - name: pairId
                            type: string
                            required: false
                  - name: execution
                    type: object
                    required: false
                    properties:
                      - name: instrument
                        type: object
                        required: false
                        properties:
                          - name: exchange
                            type: string
                            required: true
                          - name: symbol
                            type: string
                            required: true
                      - name: side
                        type: string
                        enumValues:
                          - buy
                          - sell
                        required: false
                      - name: orderType
                        type: string
                        enumValues:
                          - market
                          - limit
                        required: false
                      - name: orderKind
                        type: string
                        description: >-
                          What the order does. `other` is a kind this API
                          version does not describe; `exchangeOrderType` then
                          names it.
                        enumValues:
                          - market
                          - limit
                          - takeProfitMarket
                          - takeProfitLimit
                          - stopLossMarket
                          - stopLossLimit
                          - conditionalMarket
                          - conditionalLimit
                          - tpsl
                          - trailingStopMarket
                          - trailingStopLimit
                          - other
                        required: false
                      - name: orderQuantity
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: orderPrice
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: execPrice
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: execQuantity
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: leavesQuantity
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: position
                    type: object
                    required: false
                    properties:
                      - name: kind
                        type: string
                        description: >-
                          `reversed` - the position flipped side in one-way
                          mode.
                        enumValues:
                          - closed
                          - reversed
                        required: false
                      - name: message
                        type: string
                        required: false
                      - name: instrument
                        type: object
                        required: false
                        properties:
                          - name: exchange
                            type: string
                            required: true
                          - name: symbol
                            type: string
                            required: true
                      - name: positionSide
                        type: string
                        enumValues:
                          - long
                          - short
                          - both
                        required: false
                      - name: size
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: avgPrice
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: positionId
                        type: string
                        required: false
                  - name: cancelAllOrders
                    type: object
                    description: Outcome of /api/v1/trading/order/cancel-all.
                    required: false
                    properties:
                      - name: message
                        type: string
                        required: false
                      - name: label
                        type: string
                        required: false
                      - name: side
                        type: string
                        enumValues:
                          - buy
                          - sell
                        required: false
                      - name: orderFilter
                        type: string
                        enumValues:
                          - limit
                          - conditional
                          - tpsl
                        required: false
                      - name: instrument
                        type: object
                        required: false
                        properties:
                          - name: exchange
                            type: string
                            required: true
                          - name: symbol
                            type: string
                            required: true
                      - name: market
                        type: object
                        required: false
                        properties:
                          - name: marketType
                            type: string
                            enumValues:
                              - spot
                              - perpetual
                              - cfd
                            required: true
                          - name: contractType
                            type: string
                            enumValues:
                              - linear
                              - inverse
                            required: false
                  - name: closePosition
                    type: object
                    description: Outcome of /api/v1/trading/position/close.
                    required: false
                    properties:
                      - name: message
                        type: string
                        required: false
                      - name: position
                        type: object
                        description: >-
                          Same shape as `position` of the REST position
                          requests.
                        required: false
                        properties:
                          - name: positionId
                            type: string
                            required: false
                          - name: instrument
                            type: object
                            required: false
                            properties:
                              - name: exchange
                                type: string
                                required: true
                              - name: symbol
                                type: string
                                required: true
                          - name: positionSide
                            type: string
                            enumValues:
                              - long
                              - short
                            required: false
                  - name: closeAllPositions
                    type: object
                    description: Outcome of /api/v1/trading/position/close-all.
                    required: false
                    properties:
                      - name: message
                        type: string
                        required: false
                      - name: instrument
                        type: object
                        required: false
                        properties:
                          - name: exchange
                            type: string
                            required: true
                          - name: symbol
                            type: string
                            required: true
                      - name: market
                        type: object
                        required: false
                        properties:
                          - name: marketType
                            type: string
                            enumValues:
                              - spot
                              - perpetual
                              - cfd
                            required: true
                          - name: contractType
                            type: string
                            enumValues:
                              - linear
                              - inverse
                            required: false
                      - name: positionSide
                        type: string
                        enumValues:
                          - long
                          - short
                        required: false
                      - name: unrealizedPnl
                        type: string
                        enumValues:
                          - positive
                          - negative
                        required: false
                  - name: addPositionTpSl
                    type: object
                    description: Outcome of /api/v1/trading/position/add-tpsl.
                    required: false
                    properties:
                      - name: message
                        type: string
                        required: false
                      - name: position
                        type: object
                        description: >-
                          Same shape as `position` of the REST position
                          requests.
                        required: false
                        properties:
                          - name: positionId
                            type: string
                            required: false
                          - name: instrument
                            type: object
                            required: false
                            properties:
                              - name: exchange
                                type: string
                                required: true
                              - name: symbol
                                type: string
                                required: true
                          - name: positionSide
                            type: string
                            enumValues:
                              - long
                              - short
                            required: false
                      - name: pairId
                        type: string
                        required: false
                      - name: takeProfit
                        type: object
                        required: false
                        properties:
                          - name: triggerPrice
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: limitPrice
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: triggerBy
                            type: string
                            enumValues:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            required: false
                      - name: stopLoss
                        type: object
                        required: false
                        properties:
                          - name: triggerPrice
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: limitPrice
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: triggerBy
                            type: string
                            enumValues:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            required: false
                      - name: size
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: replacePositionTpSl
                    type: object
                    description: >-
                      Outcome of a take-profit/stop-loss replacement made in
                      TakeProfit.
                    required: false
                    properties:
                      - name: message
                        type: string
                        required: false
                      - name: position
                        type: object
                        description: >-
                          Same shape as `position` of the REST position
                          requests.
                        required: false
                        properties:
                          - name: positionId
                            type: string
                            required: false
                          - name: instrument
                            type: object
                            required: false
                            properties:
                              - name: exchange
                                type: string
                                required: true
                              - name: symbol
                                type: string
                                required: true
                          - name: positionSide
                            type: string
                            enumValues:
                              - long
                              - short
                            required: false
                      - name: pairId
                        type: string
                        required: false
                      - name: takeProfit
                        type: object
                        required: false
                        properties:
                          - name: triggerPrice
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: limitPrice
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: triggerBy
                            type: string
                            enumValues:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            required: false
                      - name: stopLoss
                        type: object
                        required: false
                        properties:
                          - name: triggerPrice
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: limitPrice
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: triggerBy
                            type: string
                            enumValues:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            required: false
                      - name: size
                        type: string
                        description: Decimal number as a string.
                        required: false
                  - name: setPositionTrailingStop
                    type: object
                    description: Outcome of a position trailing stop set in TakeProfit.
                    required: false
                    properties:
                      - name: message
                        type: string
                        required: false
                      - name: position
                        type: object
                        description: >-
                          Same shape as `position` of the REST position
                          requests.
                        required: false
                        properties:
                          - name: positionId
                            type: string
                            required: false
                          - name: instrument
                            type: object
                            required: false
                            properties:
                              - name: exchange
                                type: string
                                required: true
                              - name: symbol
                                type: string
                                required: true
                          - name: positionSide
                            type: string
                            enumValues:
                              - long
                              - short
                            required: false
                      - name: trailingStop
                        type: object
                        description: >-
                          Same shape as `order.trailingStop` of
                          /api/v1/trading/order/create.
                        required: false
                        properties:
                          - name: distance
                            type: object
                            required: false
                            properties:
                              - name: price
                                type: string
                                description: Decimal number as a string.
                                required: false
                              - name: percent
                                type: string
                                description: Decimal number as a string.
                                required: false
                          - name: activation
                            type: object
                            required: false
                            properties:
                              - name: price
                                type: string
                                description: Decimal number as a string.
                                required: false
                              - name: direction
                                type: string
                                enumValues:
                                  - risesTo
                                  - fallsTo
                                required: false
                          - name: triggerBy
                            type: string
                            enumValues:
                              - lastPrice
                              - markPrice
                              - indexPrice
                            required: false
                  - name: hmr
                    type: object
                    description: >
                      Higher margin requirements (Exness) for instruments the
                      account

                      holds a position on: sent when a window is about to start
                      or is in

                      force.
                    required: false
                    properties:
                      - name: entries
                        type: array
                        required: false
                        properties:
                          - name: instrument
                            type: object
                            required: false
                            properties:
                              - name: exchange
                                type: string
                                required: true
                              - name: symbol
                                type: string
                                required: true
                          - name: start
                            type: string
                            required: false
                          - name: end
                            type: string
                            required: false
                          - name: effectiveLeverage
                            type: string
                            description: Decimal number as a string.
                            required: false
                          - name: leverage
                            type: string
                            description: The instrument's leverage outside the window.
                            required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - notification
          properties:
            type:
              type: string
              const: notification
              x-parser-schema-id: <anonymous-schema-116>
            seq: *ref_5
            connectorCode: *ref_1
            notification:
              type: object
              description: >
                A notification about a request or an account event. Exactly one
                of the

                objects other than `timestamp` is set. A request outcome carries

                `message` when it failed.
              properties:
                timestamp:
                  type: string
                  format: date-time
                  x-parser-schema-id: <anonymous-schema-117>
                order:
                  type: object
                  required:
                    - kind
                  description: The outcome of an order request.
                  properties:
                    kind:
                      type: string
                      enum:
                        - placed
                        - failure
                        - rejected
                        - cancelled
                        - updated
                        - replaced
                        - failedReplace
                        - replaceStatusUnknown
                        - replaceOrderLost
                      description: >
                        `replaced` - an amend on a connector that cannot amend
                        in place

                        (`replacesOrder`) cancelled the order and placed a new
                        one: the

                        order continues under `replacementOrderId`.
                        `failedReplace` - such

                        an amend did not apply and the order keeps its previous
                        parameters,

                        under `replacementOrderId` when it was re-placed.

                        `replaceStatusUnknown` - no verdict yet: watch both ids.

                        `replaceOrderLost` - the old order was cancelled and
                        nothing could

                        be placed: no working order is left.
                      x-parser-schema-id: <anonymous-schema-118>
                    message:
                      type: string
                      x-parser-schema-id: <anonymous-schema-119>
                    orderId:
                      type: string
                      description: The order the request was about.
                      x-parser-schema-id: <anonymous-schema-120>
                    replacementOrderId:
                      type: string
                      description: >-
                        The id the order continues under after a
                        cancel-and-place amend.
                      x-parser-schema-id: <anonymous-schema-121>
                    instrument: *ref_4
                    side: *ref_8
                    orderType:
                      type: string
                      enum:
                        - market
                        - limit
                      x-parser-schema-id: <anonymous-schema-122>
                    orderKind: *ref_9
                    exchangeOrderType:
                      type: string
                      x-parser-schema-id: <anonymous-schema-123>
                    quantity: *ref_2
                    limitPrice: *ref_2
                    triggerPrice: *ref_2
                    previousQuantity:
                      allOf:
                        - *ref_2
                      description: >-
                        Before an amend; equal to `quantity` when the amend did
                        not apply.
                      x-parser-schema-id: <anonymous-schema-124>
                    previousLimitPrice: *ref_2
                    previousTriggerPrice: *ref_2
                    tpSl:
                      type: object
                      description: Present when the order is a take-profit/stop-loss leg.
                      properties:
                        kind:
                          type: string
                          enum:
                            - takeProfit
                            - stopLoss
                            - spotBracket
                            - takeProfitStopLoss
                          x-parser-schema-id: <anonymous-schema-126>
                        pairId:
                          type: string
                          x-parser-schema-id: <anonymous-schema-127>
                      x-parser-schema-id: <anonymous-schema-125>
                  x-parser-schema-id: NotificationOrder
                execution:
                  type: object
                  properties:
                    instrument: *ref_4
                    side: *ref_8
                    orderType:
                      type: string
                      enum:
                        - market
                        - limit
                      x-parser-schema-id: <anonymous-schema-128>
                    orderKind: *ref_9
                    orderQuantity: *ref_2
                    orderPrice: *ref_2
                    execPrice: *ref_2
                    execQuantity: *ref_2
                    leavesQuantity: *ref_2
                  x-parser-schema-id: NotificationExecution
                position:
                  type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - closed
                        - reversed
                      description: '`reversed` - the position flipped side in one-way mode.'
                      x-parser-schema-id: <anonymous-schema-129>
                    message:
                      type: string
                      x-parser-schema-id: <anonymous-schema-130>
                    instrument: *ref_4
                    positionSide:
                      type: string
                      enum:
                        - long
                        - short
                        - both
                      x-parser-schema-id: <anonymous-schema-131>
                    size: *ref_2
                    avgPrice: *ref_2
                    positionId:
                      type: string
                      x-parser-schema-id: <anonymous-schema-132>
                  x-parser-schema-id: NotificationPosition
                cancelAllOrders:
                  type: object
                  description: Outcome of /api/v1/trading/order/cancel-all.
                  properties:
                    message:
                      type: string
                      x-parser-schema-id: <anonymous-schema-134>
                    label:
                      type: string
                      x-parser-schema-id: <anonymous-schema-135>
                    side: *ref_8
                    orderFilter:
                      type: string
                      enum:
                        - limit
                        - conditional
                        - tpsl
                      x-parser-schema-id: <anonymous-schema-136>
                    instrument: *ref_4
                    market: &ref_14
                      type: object
                      required:
                        - marketType
                      properties:
                        marketType:
                          type: string
                          enum:
                            - spot
                            - perpetual
                            - cfd
                          x-parser-schema-id: <anonymous-schema-137>
                        contractType:
                          type: string
                          enum:
                            - linear
                            - inverse
                          x-parser-schema-id: <anonymous-schema-138>
                      x-parser-schema-id: Market
                  x-parser-schema-id: <anonymous-schema-133>
                closePosition:
                  type: object
                  description: Outcome of /api/v1/trading/position/close.
                  properties:
                    message:
                      type: string
                      x-parser-schema-id: <anonymous-schema-140>
                    position: &ref_15
                      type: object
                      description: Same shape as `position` of the REST position requests.
                      properties:
                        positionId:
                          type: string
                          x-parser-schema-id: <anonymous-schema-141>
                        instrument: *ref_4
                        positionSide:
                          type: string
                          enum:
                            - long
                            - short
                          x-parser-schema-id: <anonymous-schema-142>
                      x-parser-schema-id: PositionRef
                  x-parser-schema-id: <anonymous-schema-139>
                closeAllPositions:
                  type: object
                  description: Outcome of /api/v1/trading/position/close-all.
                  properties:
                    message:
                      type: string
                      x-parser-schema-id: <anonymous-schema-144>
                    instrument: *ref_4
                    market: *ref_14
                    positionSide:
                      type: string
                      enum:
                        - long
                        - short
                      x-parser-schema-id: <anonymous-schema-145>
                    unrealizedPnl:
                      type: string
                      enum:
                        - positive
                        - negative
                      x-parser-schema-id: <anonymous-schema-146>
                  x-parser-schema-id: <anonymous-schema-143>
                addPositionTpSl:
                  allOf:
                    - &ref_17
                      type: object
                      description: >-
                        What an add or replace take-profit/stop-loss request
                        asked for; `message` is set when it failed.
                      properties:
                        message:
                          type: string
                          x-parser-schema-id: <anonymous-schema-148>
                        position: *ref_15
                        pairId:
                          type: string
                          x-parser-schema-id: <anonymous-schema-149>
                        takeProfit: &ref_16
                          type: object
                          properties:
                            triggerPrice: *ref_2
                            limitPrice: *ref_2
                            triggerBy: *ref_3
                          x-parser-schema-id: TpSl
                        stopLoss: *ref_16
                        size: *ref_2
                      x-parser-schema-id: NotificationTpSl
                  description: Outcome of /api/v1/trading/position/add-tpsl.
                  x-parser-schema-id: <anonymous-schema-147>
                replacePositionTpSl:
                  allOf:
                    - *ref_17
                  description: >-
                    Outcome of a take-profit/stop-loss replacement made in
                    TakeProfit.
                  x-parser-schema-id: <anonymous-schema-150>
                setPositionTrailingStop:
                  type: object
                  description: Outcome of a position trailing stop set in TakeProfit.
                  properties:
                    message:
                      type: string
                      x-parser-schema-id: <anonymous-schema-152>
                    position: *ref_15
                    trailingStop: *ref_18
                  x-parser-schema-id: <anonymous-schema-151>
                hmr:
                  type: object
                  description: >
                    Higher margin requirements (Exness) for instruments the
                    account

                    holds a position on: sent when a window is about to start or
                    is in

                    force.
                  properties:
                    entries:
                      type: array
                      items:
                        type: object
                        properties:
                          instrument: *ref_4
                          start:
                            type: string
                            format: date-time
                            x-parser-schema-id: <anonymous-schema-156>
                          end:
                            type: string
                            format: date-time
                            x-parser-schema-id: <anonymous-schema-157>
                          effectiveLeverage: *ref_2
                          leverage:
                            allOf:
                              - *ref_2
                            description: The instrument's leverage outside the window.
                            x-parser-schema-id: <anonymous-schema-158>
                        x-parser-schema-id: <anonymous-schema-155>
                      x-parser-schema-id: <anonymous-schema-154>
                  x-parser-schema-id: <anonymous-schema-153>
              x-parser-schema-id: Notification
          x-parser-schema-id: <anonymous-schema-115>
        title: Notification
        description: |
          The outcome of a request you sent over REST (an order placed,
          rejected, amended or replaced; a bulk cancel; a position closed or
          protected) or an account event (a position closed or reversed, an
          execution, a higher margin window). Not terminal.
        example: |-
          {
            "type": "notification",
            "seq": 8,
            "connectorCode": "exness",
            "notification": {
              "timestamp": "2026-11-20T10:22:05Z",
              "order": {
                "kind": "replaced",
                "orderId": "1f2e3d4c-5b6a-4798-8a9b-0c1d2e3f4a5b",
                "replacementOrderId": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
                "instrument": {
                  "exchange": "EXNESS",
                  "symbol": "EURUSD"
                },
                "side": "buy",
                "orderType": "limit",
                "quantity": "0.1",
                "limitPrice": "1.0810",
                "previousQuantity": "0.1",
                "previousLimitPrice": "1.0800"
              }
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: notification
      - &ref_28
        id: marginMode
        contentType: application/json
        payload:
          - name: Margin mode changed
            type: object
            properties:
              - name: type
                type: string
                description: marginMode
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                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: marginMode
                type: string
                enumValues:
                  - cross
                  - isolated
                  - portfolio
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - marginMode
          properties:
            type:
              type: string
              const: marginMode
              x-parser-schema-id: <anonymous-schema-160>
            seq: *ref_5
            connectorCode: *ref_1
            marginMode: *ref_19
          x-parser-schema-id: <anonymous-schema-159>
        title: Margin mode changed
        example: |-
          {
            "type": "<string>",
            "seq": 123,
            "connectorCode": "<string>",
            "marginMode": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: marginMode
      - &ref_29
        id: spotMarginTrade
        contentType: application/json
        payload:
          - name: Spot margin trading switched
            type: object
            properties:
              - name: type
                type: string
                description: spotMarginTrade
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                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: enabled
                type: boolean
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - enabled
          properties:
            type:
              type: string
              const: spotMarginTrade
              x-parser-schema-id: <anonymous-schema-162>
            seq: *ref_5
            connectorCode: *ref_1
            enabled:
              type: boolean
              x-parser-schema-id: <anonymous-schema-163>
          x-parser-schema-id: <anonymous-schema-161>
        title: Spot margin trading switched
        example: |-
          {
            "type": "<string>",
            "seq": 123,
            "connectorCode": "<string>",
            "enabled": true
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: spotMarginTrade
      - &ref_30
        id: executionRebate
        contentType: application/json
        payload:
          - name: Rebate of an execution
            description: >-
              A user rebate written after its execution was delivered; it sets
              `userRebateUsdt` of the execution with `execId`. Exness only for
              now.
            type: object
            properties:
              - name: type
                type: string
                description: executionRebate
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                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: execId
                type: string
                required: true
              - name: orderId
                type: string
                required: true
              - name: label
                type: string
                required: false
              - name: userRebateUsdt
                type: string
                description: Decimal number as a string.
                required: false
              - name: exchangeSpecific
                type: object
                required: false
                properties:
                  - name: exness
                    type: object
                    required: false
                    properties:
                      - name: openSpread
                        type: string
                        description: Decimal number as a string.
                        required: false
                      - name: closeSpread
                        type: string
                        description: Decimal number as a string.
                        required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - execId
            - orderId
          properties:
            type:
              type: string
              const: executionRebate
              x-parser-schema-id: <anonymous-schema-165>
            seq: *ref_5
            connectorCode: *ref_1
            execId:
              type: string
              x-parser-schema-id: <anonymous-schema-166>
            orderId:
              type: string
              x-parser-schema-id: <anonymous-schema-167>
            label: *ref_7
            userRebateUsdt: *ref_2
            exchangeSpecific:
              type: object
              properties:
                exness:
                  type: object
                  properties:
                    openSpread: *ref_2
                    closeSpread: *ref_2
                  x-parser-schema-id: <anonymous-schema-169>
              x-parser-schema-id: <anonymous-schema-168>
          x-parser-schema-id: <anonymous-schema-164>
        title: Rebate of an execution
        description: >-
          A user rebate written after its execution was delivered; it sets
          `userRebateUsdt` of the execution with `execId`. Exness only for now.
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: executionRebate
      - &ref_31
        id: warning
        contentType: application/json
        payload:
          - name: Stream degraded
            description: |
              Not terminal: the stream continues. `exchangeSession` - the
              connection to the exchange was interrupted and is being restored;
              requests may fail until it is. `dataMayBeMissing` - some account
              changes may have been missed; to resynchronise, reconnect and take
              the fresh `snapshot`.
            type: object
            properties:
              - name: type
                type: string
                description: warning
                required: true
              - name: seq
                type: integer
                description: >-
                  Number of the data frame within this connection, starting at 1
                  with the snapshot.
                required: true
              - name: reason
                type: string
                enumValues:
                  - exchangeSession
                  - dataMayBeMissing
                required: true
              - name: message
                type: string
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - seq
            - reason
            - message
          properties:
            type:
              type: string
              const: warning
              x-parser-schema-id: <anonymous-schema-171>
            seq: *ref_5
            reason:
              type: string
              enum:
                - exchangeSession
                - dataMayBeMissing
              x-parser-schema-id: <anonymous-schema-172>
            message:
              type: string
              x-parser-schema-id: <anonymous-schema-173>
          x-parser-schema-id: <anonymous-schema-170>
        title: Stream degraded
        description: |
          Not terminal: the stream continues. `exchangeSession` - the
          connection to the exchange was interrupted and is being restored;
          requests may fail until it is. `dataMayBeMissing` - some account
          changes may have been missed; to resynchronise, reconnect and take
          the fresh `snapshot`.
        example: |-
          {
            "type": "warning",
            "seq": 7,
            "reason": "dataMayBeMissing",
            "message": "account updates may have been missed"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: warning
      - &ref_32
        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: eventsStream
sendOperations:
  - *ref_20
receiveOperations: []
sendMessages:
  - *ref_21
  - *ref_22
  - *ref_23
  - *ref_24
  - *ref_25
  - *ref_26
  - *ref_27
  - *ref_28
  - *ref_29
  - *ref_30
  - *ref_31
  - *ref_32
receiveMessages: []
extensions:
  - id: x-parser-unique-object-id
    value: eventsStream
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.