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

# Trade Playground

> Single channel for order commands, positions, balances, fills



## AsyncAPI

````yaml websocket/trade.yaml qfex
id: qfex
title: Qfex
description: Single channel for order commands, positions, balances, fills
servers:
  - id: production
    protocol: wss
    host: trade.qfex.com
    bindings: []
    variables: []
address: /
parameters: []
bindings: []
operations:
  - &ref_14
    id: authenticate
    title: Authenticate
    description: Authenticate with the WebSocket gateway
    type: receive
    messages:
      - &ref_35
        id: authenticate
        contentType: application/json
        payload:
          - name: Authenticate
            description: >-
              Authenticate to the WebSocket gateway. Required before any other
              commands.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - auth
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: hmac
                    type: object
                    required: false
                    properties:
                      - name: public_key
                        type: string
                        description: Your public (API) key
                        required: false
                      - name: nonce
                        type: string
                        description: Secure random hex string
                        required: false
                      - name: unix_ts
                        type: integer
                        description: Current Unix timestamp (seconds)
                        required: false
                      - name: signature
                        type: string
                        description: Hex-encoded HMAC-SHA256(secret, "nonce:unix_ts")
                        required: false
                  - name: jwt
                    type: string
                    description: JWT token fetched via https://verify.qfex.com
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - auth
              default: auth
              x-parser-schema-id: <anonymous-schema-4>
            params:
              type: object
              properties:
                hmac:
                  type: object
                  properties:
                    public_key:
                      type: string
                      description: Your public (API) key
                      x-parser-schema-id: <anonymous-schema-7>
                    nonce:
                      type: string
                      description: Secure random hex string
                      x-parser-schema-id: <anonymous-schema-8>
                    unix_ts:
                      type: integer
                      description: Current Unix timestamp (seconds)
                      x-parser-schema-id: <anonymous-schema-9>
                    signature:
                      type: string
                      description: Hex-encoded HMAC-SHA256(secret, "nonce:unix_ts")
                      x-parser-schema-id: <anonymous-schema-10>
                  required:
                    - public_key
                    - nonce
                    - unix_ts
                    - signature
                  x-parser-schema-id: <anonymous-schema-6>
                jwt:
                  type: string
                  description: JWT token fetched via https://verify.qfex.com
                  x-parser-schema-id: <anonymous-schema-11>
              oneOf:
                - required:
                    - hmac
                  x-parser-schema-id: <anonymous-schema-12>
                - required:
                    - jwt
                  x-parser-schema-id: <anonymous-schema-13>
              x-parser-schema-id: <anonymous-schema-5>
          required:
            - type
            - params
          examples:
            - type: auth
              params:
                hmac:
                  public_key: qfex_pub_xxxxx
                  nonce: c0ffee...
                  unix_ts: 1760545414
                  signature: 5f2e...
            - type: auth
              params:
                jwt: >-
                  eyJhbGciOiJFUzI1NiIsImtpZCI6ImNiYzVmZWNmLTlhODItNGFlNy04NDFkLTBkMTdjMjUzMWM3OCIsInR5cCI6IkpXVCJ9...
          x-parser-schema-id: <anonymous-schema-3>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-2>
          x-parser-schema-id: <anonymous-schema-1>
        title: Authenticate
        description: >-
          Authenticate to the WebSocket gateway. Required before any other
          commands.
        example: |-
          {
            "type": "auth",
            "params": {
              "hmac": {
                "public_key": "qfex_pub_xxxxx",
                "nonce": "c0ffee...",
                "unix_ts": 1760545414,
                "signature": "5f2e..."
              }
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: authenticate
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: qfex
  - &ref_15
    id: subscribeOrdersStream
    title: Subscribe orders stream
    description: Subscribe to a data stream
    type: receive
    messages:
      - &ref_36
        id: subscribeOrders
        contentType: application/json
        payload:
          - name: Subscribe to Orders
            description: Subscribe to user orders. Receive live updates on current orders.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - unsubscribe
                  - subscribe
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: channels
                    type: array
                    description: positions
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum: &ref_1
                - unsubscribe
                - subscribe
              default: subscribe
              x-parser-schema-id: <anonymous-schema-17>
            params:
              type: object
              properties:
                channels:
                  type: array
                  items:
                    type: string
                    enum: &ref_2
                      - positions
                    x-parser-schema-id: <anonymous-schema-20>
                  description: positions
                  x-parser-schema-id: <anonymous-schema-19>
              x-parser-schema-id: <anonymous-schema-18>
          required: &ref_3
            - type
            - params
          examples: &ref_4
            - type: subscribe
              params:
                channels:
                  - positions
          x-parser-schema-id: <anonymous-schema-16>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-15>
          x-parser-schema-id: <anonymous-schema-14>
        title: Subscribe to Orders
        description: Subscribe to user orders. Receive live updates on current orders.
        example: |-
          {
            "type": "subscribe",
            "params": {
              "channels": [
                "positions"
              ]
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeOrders
    bindings: []
    extensions: *ref_0
  - &ref_16
    id: subscribePositionsStream
    title: Subscribe positions stream
    description: Subscribe to a data stream
    type: receive
    messages:
      - &ref_37
        id: subscribePositions
        contentType: application/json
        payload:
          - name: Subscribe to Positions
            description: >-
              Subscribe to user positions. Receive 1s pulsed updates on current
              positions.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - unsubscribe
                  - subscribe
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: channels
                    type: array
                    description: positions
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum: *ref_1
              default: subscribe
              x-parser-schema-id: <anonymous-schema-24>
            params:
              type: object
              properties:
                channels:
                  type: array
                  items:
                    type: string
                    enum: *ref_2
                    x-parser-schema-id: <anonymous-schema-27>
                  description: positions
                  x-parser-schema-id: <anonymous-schema-26>
              x-parser-schema-id: <anonymous-schema-25>
          required: *ref_3
          examples: *ref_4
          x-parser-schema-id: <anonymous-schema-23>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-22>
          x-parser-schema-id: <anonymous-schema-21>
        title: Subscribe to Positions
        description: >-
          Subscribe to user positions. Receive 1s pulsed updates on current
          positions.
        example: |-
          {
            "type": "subscribe",
            "params": {
              "channels": [
                "positions"
              ]
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribePositions
    bindings: []
    extensions: *ref_0
  - &ref_17
    id: subscribeBalanceStream
    title: Subscribe balance stream
    description: Subscribe to a data stream
    type: receive
    messages:
      - &ref_38
        id: subscribeBalance
        contentType: application/json
        payload:
          - name: Subscribe to Balance
            description: >-
              Subscribe to user balance. Receive 1s pulsed updates on current
              balance.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - unsubscribe
                  - subscribe
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: channels
                    type: array
                    description: balances
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - unsubscribe
                - subscribe
              default: subscribe
              x-parser-schema-id: <anonymous-schema-31>
            params:
              type: object
              properties:
                channels:
                  type: array
                  items:
                    type: string
                    enum:
                      - balances
                    x-parser-schema-id: <anonymous-schema-34>
                  description: balances
                  x-parser-schema-id: <anonymous-schema-33>
              x-parser-schema-id: <anonymous-schema-32>
          required:
            - type
            - params
          examples:
            - type: subscribe
              params:
                channels:
                  - balances
          x-parser-schema-id: <anonymous-schema-30>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-29>
          x-parser-schema-id: <anonymous-schema-28>
        title: Subscribe to Balance
        description: >-
          Subscribe to user balance. Receive 1s pulsed updates on current
          balance.
        example: |-
          {
            "type": "subscribe",
            "params": {
              "channels": [
                "balances"
              ]
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeBalance
    bindings: []
    extensions: *ref_0
  - &ref_18
    id: subscribeFillsStream
    title: Subscribe fills stream
    description: Subscribe to a data stream
    type: receive
    messages:
      - &ref_39
        id: subscribeFills
        contentType: application/json
        payload:
          - name: Subscribe to Fills
            description: Subscribe to user fills. Receive live updates for executed trades.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - unsubscribe
                  - subscribe
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: channels
                    type: array
                    description: fills
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - unsubscribe
                - subscribe
              default: subscribe
              x-parser-schema-id: <anonymous-schema-38>
            params:
              type: object
              properties:
                channels:
                  type: array
                  items:
                    type: string
                    enum:
                      - fills
                    x-parser-schema-id: <anonymous-schema-41>
                  description: fills
                  x-parser-schema-id: <anonymous-schema-40>
              x-parser-schema-id: <anonymous-schema-39>
          required:
            - type
            - params
          examples:
            - type: subscribe
              params:
                channels:
                  - fills
          x-parser-schema-id: <anonymous-schema-37>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-36>
          x-parser-schema-id: <anonymous-schema-35>
        title: Subscribe to Fills
        description: Subscribe to user fills. Receive live updates for executed trades.
        example: |-
          {
            "type": "subscribe",
            "params": {
              "channels": [
                "fills"
              ]
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeFills
    bindings: []
    extensions: *ref_0
  - &ref_19
    id: getLeverageLevels
    title: Get leverage levels
    description: Get user leverage levels
    type: receive
    messages:
      - &ref_40
        id: getLeverage
        contentType: application/json
        payload:
          - name: Get Leverage
            description: Get current leverage levels per symbol
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - get_user_leverage
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: limit
                    type: number
                    required: false
                  - name: offset
                    type: number
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - get_user_leverage
              default: get_user_leverage
              x-parser-schema-id: <anonymous-schema-45>
            params:
              type: object
              properties:
                limit:
                  type: number
                  x-parser-schema-id: <anonymous-schema-47>
                offset:
                  type: number
                  x-parser-schema-id: <anonymous-schema-48>
              x-parser-schema-id: <anonymous-schema-46>
          required:
            - type
            - params
          examples:
            - type: get_user_leverage
              params:
                limit: 10
                offset: 0
          x-parser-schema-id: <anonymous-schema-44>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-43>
          x-parser-schema-id: <anonymous-schema-42>
        title: Get Leverage
        description: Get current leverage levels per symbol
        example: |-
          {
            "type": "get_user_leverage",
            "params": {
              "limit": 10,
              "offset": 0
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: getLeverage
    bindings: []
    extensions: *ref_0
  - &ref_20
    id: setLeverageLevels
    title: Set leverage levels
    description: Set user leverage levels
    type: receive
    messages:
      - &ref_41
        id: setLeverage
        contentType: application/json
        payload:
          - name: Set Leverage
            description: Set leverage level for a symbol
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - set_user_leverage
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: symbol
                    type: string
                    required: false
                  - name: leverage
                    type: number
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - set_user_leverage
              default: set_user_leverage
              x-parser-schema-id: <anonymous-schema-52>
            params:
              type: object
              properties:
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-54>
                leverage:
                  type: number
                  x-parser-schema-id: <anonymous-schema-55>
              x-parser-schema-id: <anonymous-schema-53>
          required:
            - type
            - params
          examples:
            - type: set_user_leverage
              params:
                symbol: AAPL-USD
                leverage: 10
          x-parser-schema-id: <anonymous-schema-51>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-50>
          x-parser-schema-id: <anonymous-schema-49>
        title: Set Leverage
        description: Set leverage level for a symbol
        example: |-
          {
            "type": "set_user_leverage",
            "params": {
              "symbol": "AAPL-USD",
              "leverage": 10
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: setLeverage
    bindings: []
    extensions: *ref_0
  - &ref_21
    id: getAvailableLeverageLevels
    title: Get available leverage levels
    description: Get available leverage levels
    type: receive
    messages:
      - &ref_42
        id: getAvailableLeverage
        contentType: application/json
        payload:
          - name: Get Available Leverage
            description: Get available leverage levels per symbol
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - get_available_leverage_levels
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: limit
                    type: number
                    required: false
                  - name: offset
                    type: number
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - get_available_leverage_levels
              default: get_available_leverage_levels
              x-parser-schema-id: <anonymous-schema-59>
            params:
              type: object
              properties:
                limit:
                  type: number
                  x-parser-schema-id: <anonymous-schema-61>
                offset:
                  type: number
                  x-parser-schema-id: <anonymous-schema-62>
              x-parser-schema-id: <anonymous-schema-60>
          required:
            - type
            - params
          examples:
            - type: get_available_leverage_levels
              params:
                limit: 10
                offset: 0
          x-parser-schema-id: <anonymous-schema-58>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-57>
          x-parser-schema-id: <anonymous-schema-56>
        title: Get Available Leverage
        description: Get available leverage levels per symbol
        example: |-
          {
            "type": "get_available_leverage_levels",
            "params": {
              "limit": 10,
              "offset": 0
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: getAvailableLeverage
    bindings: []
    extensions: *ref_0
  - &ref_22
    id: placeOrder
    title: Place order
    description: Place a new order
    type: receive
    messages:
      - &ref_43
        id: addOrder
        contentType: application/json
        payload:
          - name: Add Order
            description: Add order.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - add_order
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: symbol
                    type: string
                    required: false
                  - name: side
                    type: string
                    enumValues:
                      - BUY
                      - SELL
                    required: false
                  - name: order_type
                    type: string
                    enumValues:
                      - LIMIT
                      - MARKET
                      - ALO
                    required: false
                  - name: order_time_in_force
                    type: string
                    enumValues:
                      - GTC
                      - IOC
                      - FOK
                    required: false
                  - name: quantity
                    type: number
                    required: false
                  - name: price
                    type: number
                    description: Only required for LIMIT or ALO orders
                    required: false
                  - name: take_profit
                    type: number
                    required: false
                  - name: stop_loss
                    type: number
                    required: false
                  - name: client_order_id
                    type: string
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - add_order
              default: add_order
              x-parser-schema-id: <anonymous-schema-66>
            params:
              type: object
              properties:
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-68>
                side:
                  type: string
                  enum:
                    - BUY
                    - SELL
                  x-parser-schema-id: <anonymous-schema-69>
                order_type:
                  type: string
                  enum:
                    - LIMIT
                    - MARKET
                    - ALO
                  x-parser-schema-id: <anonymous-schema-70>
                order_time_in_force:
                  type: string
                  enum:
                    - GTC
                    - IOC
                    - FOK
                  x-parser-schema-id: <anonymous-schema-71>
                quantity:
                  type: number
                  x-parser-schema-id: <anonymous-schema-72>
                price:
                  type: number
                  description: Only required for LIMIT or ALO orders
                  x-parser-schema-id: <anonymous-schema-73>
                take_profit:
                  type: number
                  x-parser-schema-id: <anonymous-schema-74>
                stop_loss:
                  type: number
                  x-parser-schema-id: <anonymous-schema-75>
                client_order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-76>
              required:
                - symbol
                - side
                - order_type
                - order_time_in_force
                - quantity
              x-parser-schema-id: <anonymous-schema-67>
          required:
            - type
            - params
          examples:
            - type: add_order
              params:
                symbol: AAPL-USD
                side: BUY
                order_type: LIMIT
                order_time_in_force: GTC
                quantity: 10
                price: 150.5
                client_order_id: my-order-123
          x-parser-schema-id: <anonymous-schema-65>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-64>
          x-parser-schema-id: <anonymous-schema-63>
        title: Add Order
        description: Add order.
        example: |-
          {
            "type": "add_order",
            "params": {
              "symbol": "AAPL-USD",
              "side": "BUY",
              "order_type": "LIMIT",
              "order_time_in_force": "GTC",
              "quantity": 10,
              "price": 150.5,
              "client_order_id": "my-order-123"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: addOrder
    bindings: []
    extensions: *ref_0
  - &ref_23
    id: cancelOrder
    title: Cancel order
    description: Cancel an existing order
    type: receive
    messages:
      - &ref_44
        id: cancelOrder
        contentType: application/json
        payload:
          - name: Cancel Order
            description: Cancel order.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - cancel_order
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: symbol
                    type: string
                    required: false
                  - name: order_id
                    type: string
                    required: false
                  - name: cancel_order_id_type
                    type: string
                    enumValues:
                      - order_id
                      - client_order_id
                      - twap_id
                      - client_twap_id
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - cancel_order
              default: cancel_order
              x-parser-schema-id: <anonymous-schema-80>
            params:
              type: object
              properties:
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-82>
                order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-83>
                cancel_order_id_type:
                  type: string
                  enum:
                    - order_id
                    - client_order_id
                    - twap_id
                    - client_twap_id
                  x-parser-schema-id: <anonymous-schema-84>
              required:
                - symbol
                - order_id
                - cancel_order_id_type
              x-parser-schema-id: <anonymous-schema-81>
          required:
            - type
            - params
          examples:
            - type: cancel_order
              params:
                symbol: AAPL-USD
                order_id: 5b309929-206f-40ec-804d-cbe46e81afc1
                cancel_order_id_type: order_id
          x-parser-schema-id: <anonymous-schema-79>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-78>
          x-parser-schema-id: <anonymous-schema-77>
        title: Cancel Order
        description: Cancel order.
        example: |-
          {
            "type": "cancel_order",
            "params": {
              "symbol": "AAPL-USD",
              "order_id": "5b309929-206f-40ec-804d-cbe46e81afc1",
              "cancel_order_id_type": "order_id"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: cancelOrder
    bindings: []
    extensions: *ref_0
  - &ref_24
    id: modifyOrder
    title: Modify order
    description: Modify an existing order
    type: receive
    messages:
      - &ref_45
        id: modifyOrder
        contentType: application/json
        payload:
          - name: Modify Order
            description: Modify order.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - modify_order
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: symbol
                    type: string
                    required: false
                  - name: order_id
                    type: string
                    required: false
                  - name: price
                    type: number
                    required: false
                  - name: quantity
                    type: number
                    required: false
                  - name: take_profit
                    type: number
                    required: false
                  - name: stop_loss
                    type: number
                    required: false
                  - name: side
                    type: string
                    enumValues:
                      - BUY
                      - SELL
                    required: false
                  - name: order_type
                    type: string
                    enumValues:
                      - LIMIT
                      - MARKET
                      - ALO
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - modify_order
              default: modify_order
              x-parser-schema-id: <anonymous-schema-88>
            params:
              type: object
              properties:
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-90>
                order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-91>
                price:
                  type: number
                  x-parser-schema-id: <anonymous-schema-92>
                quantity:
                  type: number
                  x-parser-schema-id: <anonymous-schema-93>
                take_profit:
                  type: number
                  x-parser-schema-id: <anonymous-schema-94>
                stop_loss:
                  type: number
                  x-parser-schema-id: <anonymous-schema-95>
                side:
                  type: string
                  enum:
                    - BUY
                    - SELL
                  x-parser-schema-id: <anonymous-schema-96>
                order_type:
                  type: string
                  enum:
                    - LIMIT
                    - MARKET
                    - ALO
                  x-parser-schema-id: <anonymous-schema-97>
              required:
                - symbol
                - order_id
                - side
                - order_type
              x-parser-schema-id: <anonymous-schema-89>
          required:
            - type
            - params
          examples:
            - type: modify_order
              params:
                symbol: AAPL-USD
                order_id: 5b309929-206f-40ec-804d-cbe46e81afc1
                price: 152
                quantity: 15
                side: BUY
                order_type: LIMIT
          x-parser-schema-id: <anonymous-schema-87>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-86>
          x-parser-schema-id: <anonymous-schema-85>
        title: Modify Order
        description: Modify order.
        example: |-
          {
            "type": "modify_order",
            "params": {
              "symbol": "AAPL-USD",
              "order_id": "5b309929-206f-40ec-804d-cbe46e81afc1",
              "price": 152,
              "quantity": 15,
              "side": "BUY",
              "order_type": "LIMIT"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: modifyOrder
    bindings: []
    extensions: *ref_0
  - &ref_25
    id: getOrder
    title: Get order
    description: Get order details
    type: receive
    messages:
      - &ref_46
        id: getOrder
        contentType: application/json
        payload:
          - name: Get Order
            description: Get order details by order_id or client_order_id.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - get_order
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: order_id
                    type: string
                    required: false
                  - name: symbol
                    type: string
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - get_order
              default: get_order
              x-parser-schema-id: <anonymous-schema-106>
            params:
              type: object
              properties:
                order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-108>
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-109>
              required:
                - order_id
                - symbol
              x-parser-schema-id: <anonymous-schema-107>
          required:
            - type
            - params
          examples:
            - type: get_order
              params:
                order_id: 5b309929-206f-40ec-804d-cbe46e81afc1
                symbol: AAPL-USD
          x-parser-schema-id: <anonymous-schema-105>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-104>
          x-parser-schema-id: <anonymous-schema-103>
        title: Get Order
        description: Get order details by order_id or client_order_id.
        example: |-
          {
            "type": "get_order",
            "params": {
              "order_id": "5b309929-206f-40ec-804d-cbe46e81afc1",
              "symbol": "AAPL-USD"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: getOrder
    bindings: []
    extensions: *ref_0
  - &ref_26
    id: getUserOrders
    title: Get user orders
    description: Get user orders
    type: receive
    messages:
      - &ref_47
        id: getUserOrders
        contentType: application/json
        payload:
          - name: Get User Orders
            description: Get active orders for the user.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - get_user_orders
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: limit
                    type: integer
                    required: false
                  - name: offset
                    type: integer
                    required: false
                  - name: symbol
                    type: string
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - get_user_orders
              default: get_user_orders
              x-parser-schema-id: <anonymous-schema-113>
            params:
              type: object
              properties:
                limit:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-115>
                offset:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-116>
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-117>
              x-parser-schema-id: <anonymous-schema-114>
          required:
            - type
            - params
          examples:
            - type: get_user_orders
              params:
                limit: 10
                offset: 0
                symbol: AAPL-USD
          x-parser-schema-id: <anonymous-schema-112>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-111>
          x-parser-schema-id: <anonymous-schema-110>
        title: Get User Orders
        description: Get active orders for the user.
        example: |-
          {
            "type": "get_user_orders",
            "params": {
              "limit": 10,
              "offset": 0,
              "symbol": "AAPL-USD"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: getUserOrders
    bindings: []
    extensions: *ref_0
  - &ref_27
    id: cancelOnDisconnect
    title: Cancel on disconnect
    description: Set cancel on disconnect preference
    type: receive
    messages:
      - &ref_48
        id: cancelOnDisconnect
        contentType: application/json
        payload:
          - name: Cancel On Disconnect
            description: >-
              Enable or disable cancel-on-disconnect feature for this
              connection.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - cancel_on_disconnect
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: cancel_on_disconnect
                    type: boolean
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - cancel_on_disconnect
              default: cancel_on_disconnect
              x-parser-schema-id: <anonymous-schema-121>
            params:
              type: object
              properties:
                cancel_on_disconnect:
                  type: boolean
                  x-parser-schema-id: <anonymous-schema-123>
              required:
                - cancel_on_disconnect
              x-parser-schema-id: <anonymous-schema-122>
          required:
            - type
            - params
          examples:
            - type: cancel_on_disconnect
              params:
                cancel_on_disconnect: true
          x-parser-schema-id: <anonymous-schema-120>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-119>
          x-parser-schema-id: <anonymous-schema-118>
        title: Cancel On Disconnect
        description: Enable or disable cancel-on-disconnect feature for this connection.
        example: |-
          {
            "type": "cancel_on_disconnect",
            "params": {
              "cancel_on_disconnect": true
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: cancelOnDisconnect
    bindings: []
    extensions: *ref_0
  - &ref_28
    id: closePosition
    title: Close position
    description: Close a position
    type: receive
    messages:
      - &ref_49
        id: closePosition
        contentType: application/json
        payload:
          - name: Close Position
            description: Close an open position.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - close_position
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: symbol
                    type: string
                    required: false
                  - name: client_order_id
                    type: string
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - close_position
              default: close_position
              x-parser-schema-id: <anonymous-schema-127>
            params:
              type: object
              properties:
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-129>
                client_order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-130>
              required:
                - symbol
              x-parser-schema-id: <anonymous-schema-128>
          required:
            - type
            - params
          examples:
            - type: close_position
              params:
                symbol: AAPL-USD
                client_order_id: my-close-order-1
          x-parser-schema-id: <anonymous-schema-126>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-125>
          x-parser-schema-id: <anonymous-schema-124>
        title: Close Position
        description: Close an open position.
        example: |-
          {
            "type": "close_position",
            "params": {
              "symbol": "AAPL-USD",
              "client_order_id": "my-close-order-1"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: closePosition
    bindings: []
    extensions: *ref_0
  - &ref_29
    id: addTwap
    title: Add twap
    description: Create a TWAP order
    type: receive
    messages:
      - &ref_50
        id: addTwap
        contentType: application/json
        payload:
          - name: Add TWAP
            description: Create a TWAP order.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - add_twap
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: symbol
                    type: string
                    required: false
                  - name: side
                    type: string
                    enumValues:
                      - BUY
                      - SELL
                    required: false
                  - name: total_quantity
                    type: number
                    required: false
                  - name: num_orders
                    type: integer
                    required: false
                  - name: order_interval_secs
                    type: integer
                    required: false
                  - name: reduce_only
                    type: boolean
                    required: false
                  - name: client_twap_id
                    type: string
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - add_twap
              default: add_twap
              x-parser-schema-id: <anonymous-schema-134>
            params:
              type: object
              properties:
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-136>
                side:
                  type: string
                  enum:
                    - BUY
                    - SELL
                  x-parser-schema-id: <anonymous-schema-137>
                total_quantity:
                  type: number
                  x-parser-schema-id: <anonymous-schema-138>
                num_orders:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-139>
                order_interval_secs:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-140>
                reduce_only:
                  type: boolean
                  x-parser-schema-id: <anonymous-schema-141>
                client_twap_id:
                  type: string
                  nullable: true
                  x-parser-schema-id: <anonymous-schema-142>
              required:
                - symbol
                - side
                - total_quantity
                - num_orders
                - order_interval_secs
                - reduce_only
              x-parser-schema-id: <anonymous-schema-135>
          required:
            - type
            - params
          examples:
            - type: add_twap
              params:
                symbol: AAPL-USD
                side: BUY
                total_quantity: 10
                num_orders: 5
                order_interval_secs: 30
                reduce_only: false
                client_twap_id: rebalance-aapl-001
          x-parser-schema-id: <anonymous-schema-133>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-132>
          x-parser-schema-id: <anonymous-schema-131>
        title: Add TWAP
        description: Create a TWAP order.
        example: |-
          {
            "type": "add_twap",
            "params": {
              "symbol": "AAPL-USD",
              "side": "BUY",
              "total_quantity": 10,
              "num_orders": 5,
              "order_interval_secs": 30,
              "reduce_only": false,
              "client_twap_id": "rebalance-aapl-001"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: addTwap
    bindings: []
    extensions: *ref_0
  - &ref_30
    id: getUserTrades
    title: Get user trades
    description: Get user trades
    type: receive
    messages:
      - &ref_51
        id: getUserTrades
        contentType: application/json
        payload:
          - name: Get User Trades
            description: Get user trade history.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - get_user_trades
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: limit
                    type: integer
                    required: false
                  - name: offset
                    type: integer
                    required: false
                  - name: order_id
                    type: string
                    required: false
                  - name: start_ts
                    type: integer
                    description: Unix timestamp in seconds
                    required: false
                  - name: end_ts
                    type: integer
                    description: Unix timestamp in seconds
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - get_user_trades
              default: get_user_trades
              x-parser-schema-id: <anonymous-schema-146>
            params:
              type: object
              properties:
                limit:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-148>
                offset:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-149>
                order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-150>
                start_ts:
                  type: integer
                  description: Unix timestamp in seconds
                  x-parser-schema-id: <anonymous-schema-151>
                end_ts:
                  type: integer
                  description: Unix timestamp in seconds
                  x-parser-schema-id: <anonymous-schema-152>
              x-parser-schema-id: <anonymous-schema-147>
          required:
            - type
            - params
          examples:
            - type: get_user_trades
              params:
                limit: 20
                start_ts: 1760545414
          x-parser-schema-id: <anonymous-schema-145>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-144>
          x-parser-schema-id: <anonymous-schema-143>
        title: Get User Trades
        description: Get user trade history.
        example: |-
          {
            "type": "get_user_trades",
            "params": {
              "limit": 20,
              "start_ts": 1760545414
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: getUserTrades
    bindings: []
    extensions: *ref_0
  - &ref_31
    id: cancelStopOrder
    title: Cancel stop order
    description: Cancel a stop order
    type: receive
    messages:
      - &ref_52
        id: cancelStopOrder
        contentType: application/json
        payload:
          - name: Cancel Stop Order
            description: Cancel a stop order.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - cancel_stop_order
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: stop_order_id
                    type: string
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - cancel_stop_order
              default: cancel_stop_order
              x-parser-schema-id: <anonymous-schema-156>
            params:
              type: object
              properties:
                stop_order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-158>
              required:
                - stop_order_id
              x-parser-schema-id: <anonymous-schema-157>
          required:
            - type
            - params
          examples:
            - type: cancel_stop_order
              params:
                stop_order_id: stop-order-uuid
          x-parser-schema-id: <anonymous-schema-155>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-154>
          x-parser-schema-id: <anonymous-schema-153>
        title: Cancel Stop Order
        description: Cancel a stop order.
        example: |-
          {
            "type": "cancel_stop_order",
            "params": {
              "stop_order_id": "stop-order-uuid"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: cancelStopOrder
    bindings: []
    extensions: *ref_0
  - &ref_32
    id: modifyStopOrder
    title: Modify stop order
    description: Modify a stop order
    type: receive
    messages:
      - &ref_53
        id: modifyStopOrder
        contentType: application/json
        payload:
          - name: Modify Stop Order
            description: Modify a stop order.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - modify_stop_order
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: stop_order_id
                    type: string
                    required: false
                  - name: symbol
                    type: string
                    required: false
                  - name: price
                    type: number
                    required: false
                  - name: quantity
                    type: number
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - modify_stop_order
              default: modify_stop_order
              x-parser-schema-id: <anonymous-schema-162>
            params:
              type: object
              properties:
                stop_order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-164>
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-165>
                price:
                  type: number
                  x-parser-schema-id: <anonymous-schema-166>
                quantity:
                  type: number
                  x-parser-schema-id: <anonymous-schema-167>
              required:
                - stop_order_id
                - symbol
                - price
                - quantity
              x-parser-schema-id: <anonymous-schema-163>
          required:
            - type
            - params
          examples:
            - type: modify_stop_order
              params:
                stop_order_id: stop-order-uuid
                symbol: AAPL-USD
                price: 160
                quantity: 5
          x-parser-schema-id: <anonymous-schema-161>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-160>
          x-parser-schema-id: <anonymous-schema-159>
        title: Modify Stop Order
        description: Modify a stop order.
        example: |-
          {
            "type": "modify_stop_order",
            "params": {
              "stop_order_id": "stop-order-uuid",
              "symbol": "AAPL-USD",
              "price": 160,
              "quantity": 5
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: modifyStopOrder
    bindings: []
    extensions: *ref_0
  - &ref_33
    id: unsubscribe
    title: Unsubscribe
    description: Unsubscribe from channels
    type: receive
    messages:
      - &ref_54
        id: unsubscribe
        contentType: application/json
        payload:
          - name: Unsubscribe
            description: Unsubscribe from channels.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - unsubscribe
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: channels
                    type: array
                    required: false
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - unsubscribe
              default: unsubscribe
              x-parser-schema-id: <anonymous-schema-171>
            params:
              type: object
              properties:
                channels:
                  type: array
                  items:
                    type: string
                    enum:
                      - order_responses
                      - positions
                      - balances
                      - stop_orders
                      - fills
                    x-parser-schema-id: <anonymous-schema-174>
                  x-parser-schema-id: <anonymous-schema-173>
              required:
                - channels
              x-parser-schema-id: <anonymous-schema-172>
          required:
            - type
            - params
          examples:
            - type: unsubscribe
              params:
                channels:
                  - order_responses
                  - positions
          x-parser-schema-id: <anonymous-schema-170>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-169>
          x-parser-schema-id: <anonymous-schema-168>
        title: Unsubscribe
        description: Unsubscribe from channels.
        example: |-
          {
            "type": "unsubscribe",
            "params": {
              "channels": [
                "order_responses",
                "positions"
              ]
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribe
    bindings: []
    extensions: *ref_0
  - &ref_34
    id: receiveUpdates
    title: Receive updates
    description: Receive all update messages and events
    type: send
    messages:
      - &ref_55
        id: balanceUpdate
        contentType: application/json
        payload:
          - examples: &ref_5
              - type: subscribed
                connection_id: ee987ddf-822c-4356-b0d1-012314859b00
                message_id: 1
                id: 3ab267fd-7c83-49c6-b42e-65bb94682b41
                channel: v4_balances
                contents:
                  - id: 2cb208e3-6e54-48c4-82e9-641e64bf185d
                    user_id: 0f5208e3-6e54-48c4-82e9-641e64bf185d
                    deposit: 1000
                    realised_pnl: -898.65735
                    unrealised_pnl: 0
                    order_margin: 0
                    position_margin: 0
                    net_funding: -1.5354636
                    available_balance: 99.80721
            allOf: &ref_6
              - &ref_7
                type: object
                properties:
                  type:
                    type: string
                    x-parser-schema-id: <anonymous-schema-178>
                  connection_id:
                    type: string
                    x-parser-schema-id: <anonymous-schema-179>
                  message_id:
                    type: integer
                    x-parser-schema-id: <anonymous-schema-180>
                  channel:
                    type: string
                    x-parser-schema-id: <anonymous-schema-181>
                  id:
                    type: string
                    x-parser-schema-id: <anonymous-schema-182>
                required:
                  - type
                  - connection_id
                  - message_id
                x-parser-schema-id: MessageEnvelope
              - type: object
                properties:
                  contents:
                    type: array
                    items: &ref_13
                      type: object
                      properties:
                        id:
                          type: string
                          x-parser-schema-id: <anonymous-schema-185>
                        user_id:
                          type: string
                          x-parser-schema-id: <anonymous-schema-186>
                        deposit:
                          type: number
                          x-parser-schema-id: <anonymous-schema-187>
                        realised_pnl:
                          type: number
                          x-parser-schema-id: <anonymous-schema-188>
                        order_margin:
                          type: number
                          x-parser-schema-id: <anonymous-schema-189>
                        position_margin:
                          type: number
                          x-parser-schema-id: <anonymous-schema-190>
                        unrealised_pnl:
                          type: number
                          x-parser-schema-id: <anonymous-schema-191>
                        net_funding:
                          type: number
                          x-parser-schema-id: <anonymous-schema-192>
                        available_balance:
                          type: number
                          x-parser-schema-id: <anonymous-schema-193>
                        referral_rewards:
                          type: number
                          x-parser-schema-id: <anonymous-schema-194>
                        fees:
                          type: number
                          x-parser-schema-id: <anonymous-schema-195>
                      x-parser-schema-id: BalancePayload
                    x-parser-schema-id: <anonymous-schema-184>
                x-parser-schema-id: <anonymous-schema-183>
            x-parser-schema-id: <anonymous-schema-177>
            name: Balance Update
            description: User balance updates
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          examples: *ref_5
          allOf: *ref_6
          x-parser-schema-id: <anonymous-schema-177>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-176>
          x-parser-schema-id: <anonymous-schema-175>
        title: Balance Update
        description: User balance updates
        example: |-
          {
            "type": "subscribed",
            "connection_id": "ee987ddf-822c-4356-b0d1-012314859b00",
            "message_id": 1,
            "id": "3ab267fd-7c83-49c6-b42e-65bb94682b41",
            "channel": "v4_balances",
            "contents": [
              {
                "id": "2cb208e3-6e54-48c4-82e9-641e64bf185d",
                "user_id": "0f5208e3-6e54-48c4-82e9-641e64bf185d",
                "deposit": 1000,
                "realised_pnl": -898.65735,
                "unrealised_pnl": 0,
                "order_margin": 0,
                "position_margin": 0,
                "net_funding": -1.5354636,
                "available_balance": 99.80721
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: balanceUpdate
      - &ref_56
        id: positionUpdate
        contentType: application/json
        payload:
          - examples: &ref_8
              - type: subscribed
                connection_id: ee987ddf-822c-4356-b0d1-012314859b00
                message_id: 1
                id: 3ab267fd-7c83-49c6-b42e-65bb94682b41
                channel: v4_positions
                contents:
                  - id: PLTR-USD
                    symbol: PLTR-USD
                    user_id: 0f5208e3-6e54-48c4-82e9-641e64bf185d
                    position: 0
                    margin_alloc: 0
                    realised_pnl: 1.327875
                    unrealised_pnl: 0
                    net_funding: 0.00000482
                    open_orders: 1
                    open_quantity: 10
                    leverage: 20
                    initial_margin: 0
                    maintenance_margin: 0
                    average_price: 0
                    timestamp: '2025-05-09T03:47:20.505934+00:00'
            allOf: &ref_9
              - *ref_7
              - type: object
                properties:
                  contents:
                    type: array
                    items: &ref_12
                      type: object
                      properties:
                        id:
                          type: string
                          x-parser-schema-id: <anonymous-schema-201>
                        symbol:
                          type: string
                          x-parser-schema-id: <anonymous-schema-202>
                        position:
                          type: number
                          x-parser-schema-id: <anonymous-schema-203>
                        margin_alloc:
                          type: number
                          x-parser-schema-id: <anonymous-schema-204>
                        realised_pnl:
                          type: number
                          x-parser-schema-id: <anonymous-schema-205>
                        unrealised_pnl:
                          type: number
                          x-parser-schema-id: <anonymous-schema-206>
                        net_funding:
                          type: number
                          x-parser-schema-id: <anonymous-schema-207>
                        open_orders:
                          type: number
                          x-parser-schema-id: <anonymous-schema-208>
                        open_quantity:
                          type: number
                          x-parser-schema-id: <anonymous-schema-209>
                        leverage:
                          type: number
                          x-parser-schema-id: <anonymous-schema-210>
                        initial_margin:
                          type: number
                          x-parser-schema-id: <anonymous-schema-211>
                        maintenance_margin:
                          type: number
                          x-parser-schema-id: <anonymous-schema-212>
                        average_price:
                          type: number
                          x-parser-schema-id: <anonymous-schema-213>
                      x-parser-schema-id: PositionPayload
                    x-parser-schema-id: <anonymous-schema-200>
                x-parser-schema-id: <anonymous-schema-199>
            x-parser-schema-id: <anonymous-schema-198>
            name: Position Update
            description: User position updates
        headers:
          - name: headers
            type: object
            properties:
              - name: x-qfex-client
                type: string
                description: Client identifier
                required: false
        jsonPayloadSchema:
          examples: *ref_8
          allOf: *ref_9
          x-parser-schema-id: <anonymous-schema-198>
        jsonHeadersSchema:
          type: object
          properties:
            x-qfex-client:
              type: string
              description: Client identifier
              x-parser-schema-id: <anonymous-schema-197>
          x-parser-schema-id: <anonymous-schema-196>
        title: Position Update
        description: User position updates
        example: |-
          {
            "type": "subscribed",
            "connection_id": "ee987ddf-822c-4356-b0d1-012314859b00",
            "message_id": 1,
            "id": "3ab267fd-7c83-49c6-b42e-65bb94682b41",
            "channel": "v4_positions",
            "contents": [
              {
                "id": "PLTR-USD",
                "symbol": "PLTR-USD",
                "user_id": "0f5208e3-6e54-48c4-82e9-641e64bf185d",
                "position": 0,
                "margin_alloc": 0,
                "realised_pnl": 1.327875,
                "unrealised_pnl": 0,
                "net_funding": 0.00000482,
                "open_orders": 1,
                "open_quantity": 10,
                "leverage": 20,
                "initial_margin": 0,
                "maintenance_margin": 0,
                "average_price": 0,
                "timestamp": "2025-05-09T03:47:20.505934+00:00"
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: positionUpdate
      - &ref_57
        id: orderResponse
        contentType: application/json
        payload:
          - name: Order Response
            description: Response containing a single order.
            type: object
            properties:
              - name: order_response
                type: object
                required: false
                properties:
                  - name: order_id
                    type: string
                    required: false
                  - name: symbol
                    type: string
                    required: false
                  - name: status
                    type: string
                    enumValues:
                      - ACK
                      - FILLED
                      - MODIFIED
                      - CANCELLED
                      - CANCELLED_STP
                      - REJECTED
                      - NO_SUCH_ORDER
                      - INVALID_ORDER_TYPE
                      - BAD_SYMBOL
                      - PRICE_LESS_THAN_MIN_PRICE
                      - PRICE_GREATER_THAN_MAX_PRICE
                      - CANNOT_MODIFY_PARTIAL_FILL
                      - FAILED_MARGIN_CHECK
                      - INVALID_TICK_SIZE_PRECISION_PRICE
                      - INVALID_TICK_SIZE_PRECISION_QUANTITY
                      - QUANTITY_LESS_THAN_MIN_QUANTITY
                      - QUANTITY_GREATER_THAN_MAX_QUANTITY
                      - INVALID_TIME_IN_FORCE
                      - REJECTED_WOULD_BREACH_MAX_NOTIONAL
                      - CANNOT_MODIFY_NO_SUCH_ORDER
                      - REJECTED_MARKET_CLOSED
                      - REJECTED_FAILED_TO_PROCESS
                      - INVALID_TAKEPROFIT_PRICE
                      - INVALID_STOPLOSS_PRICE
                      - RATE_LIMITED
                      - REJECTED_TOO_MANY_OPEN_ORDERS
                      - REJECTED_OPEN_INTEREST_LIMIT
                    required: false
                  - name: quantity
                    type: number
                    required: false
                  - name: price
                    type: number
                    required: false
                  - name: take_profit
                    type: number
                    required: false
                  - name: stop_loss
                    type: number
                    required: false
                  - name: side
                    type: string
                    enumValues:
                      - BUY
                      - SELL
                    required: false
                  - name: type
                    type: string
                    enumValues:
                      - LIMIT
                      - MARKET
                      - ALO
                      - TAKE_PROFIT
                      - STOP_LOSS
                      - STOP_MARKET
                    required: false
                  - name: time_in_force
                    type: string
                    enumValues:
                      - GTC
                      - IOC
                      - FOK
                    required: false
                  - name: user_id
                    type: string
                    required: false
                  - name: client_order_id
                    type: string
                    required: false
                  - name: quantity_remaining
                    type: number
                    required: false
                  - name: update_time
                    type: number
                    description: Timestamp in seconds with fractional part
                    required: false
                  - name: trade_id
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            order_response: &ref_10
              type: object
              properties:
                order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-215>
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-216>
                status:
                  type: string
                  enum:
                    - ACK
                    - FILLED
                    - MODIFIED
                    - CANCELLED
                    - CANCELLED_STP
                    - REJECTED
                    - NO_SUCH_ORDER
                    - INVALID_ORDER_TYPE
                    - BAD_SYMBOL
                    - PRICE_LESS_THAN_MIN_PRICE
                    - PRICE_GREATER_THAN_MAX_PRICE
                    - CANNOT_MODIFY_PARTIAL_FILL
                    - FAILED_MARGIN_CHECK
                    - INVALID_TICK_SIZE_PRECISION_PRICE
                    - INVALID_TICK_SIZE_PRECISION_QUANTITY
                    - QUANTITY_LESS_THAN_MIN_QUANTITY
                    - QUANTITY_GREATER_THAN_MAX_QUANTITY
                    - INVALID_TIME_IN_FORCE
                    - REJECTED_WOULD_BREACH_MAX_NOTIONAL
                    - CANNOT_MODIFY_NO_SUCH_ORDER
                    - REJECTED_MARKET_CLOSED
                    - REJECTED_FAILED_TO_PROCESS
                    - INVALID_TAKEPROFIT_PRICE
                    - INVALID_STOPLOSS_PRICE
                    - RATE_LIMITED
                    - REJECTED_TOO_MANY_OPEN_ORDERS
                    - REJECTED_OPEN_INTEREST_LIMIT
                  x-parser-schema-id: <anonymous-schema-217>
                quantity:
                  type: number
                  x-parser-schema-id: <anonymous-schema-218>
                price:
                  type: number
                  x-parser-schema-id: <anonymous-schema-219>
                take_profit:
                  type: number
                  x-parser-schema-id: <anonymous-schema-220>
                stop_loss:
                  type: number
                  x-parser-schema-id: <anonymous-schema-221>
                side:
                  type: string
                  enum:
                    - BUY
                    - SELL
                  x-parser-schema-id: <anonymous-schema-222>
                type:
                  type: string
                  enum:
                    - LIMIT
                    - MARKET
                    - ALO
                    - TAKE_PROFIT
                    - STOP_LOSS
                    - STOP_MARKET
                  x-parser-schema-id: <anonymous-schema-223>
                time_in_force:
                  type: string
                  enum:
                    - GTC
                    - IOC
                    - FOK
                  x-parser-schema-id: <anonymous-schema-224>
                user_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-225>
                client_order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-226>
                quantity_remaining:
                  type: number
                  x-parser-schema-id: <anonymous-schema-227>
                update_time:
                  type: number
                  description: Timestamp in seconds with fractional part
                  x-parser-schema-id: <anonymous-schema-228>
                trade_id:
                  type: string
                  nullable: true
                  x-parser-schema-id: <anonymous-schema-229>
              x-parser-schema-id: OrderResponse
          x-parser-schema-id: <anonymous-schema-214>
        title: Order Response
        description: Response containing a single order.
        example: |-
          {
            "order_response": {
              "order_id": "<string>",
              "symbol": "<string>",
              "status": "<string>",
              "quantity": 123,
              "price": 123,
              "take_profit": 123,
              "stop_loss": 123,
              "side": "<string>",
              "type": "<string>",
              "time_in_force": "<string>",
              "user_id": "<string>",
              "client_order_id": "<string>",
              "quantity_remaining": 123,
              "update_time": 123,
              "trade_id": "<string>"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: orderResponse
      - &ref_58
        id: fillResponse
        contentType: application/json
        payload:
          - name: Fill Response
            description: Response containing a single fill.
            type: object
            properties:
              - name: fill_response
                type: object
                required: false
                properties:
                  - name: trade_id
                    type: string
                    required: false
                  - name: user_id
                    type: string
                    required: false
                  - name: symbol
                    type: string
                    required: false
                  - name: price
                    type: number
                    required: false
                  - name: quantity
                    type: number
                    required: false
                  - name: side
                    type: string
                    enumValues:
                      - BUY
                      - SELL
                    required: false
                  - name: aggressor_side
                    type: string
                    enumValues:
                      - BUY
                      - SELL
                    required: false
                  - name: order_id
                    type: string
                    required: false
                  - name: fee
                    type: number
                    required: false
                  - name: order_type
                    type: string
                    enumValues:
                      - LIMIT
                      - MARKET
                      - ALO
                      - TAKE_PROFIT
                      - STOP_LOSS
                      - STOP_MARKET
                    required: false
                  - name: tif
                    type: string
                    enumValues:
                      - GTC
                      - IOC
                      - FOK
                    required: false
                  - name: order_price
                    type: number
                    required: false
                  - name: client_order_id
                    type: string
                    required: false
                  - name: remaining_quantity
                    type: number
                    required: false
                  - name: take_profit
                    type: number
                    required: false
                  - name: stop_loss
                    type: number
                    required: false
                  - name: execution_type
                    type: string
                    required: false
                  - name: timestamp
                    type: number
                    description: Timestamp in seconds with fractional part
                    required: false
                  - name: realised_pnl
                    type: number
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            fill_response:
              type: object
              properties:
                trade_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-231>
                user_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-232>
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-233>
                price:
                  type: number
                  x-parser-schema-id: <anonymous-schema-234>
                quantity:
                  type: number
                  x-parser-schema-id: <anonymous-schema-235>
                side:
                  type: string
                  enum:
                    - BUY
                    - SELL
                  x-parser-schema-id: <anonymous-schema-236>
                aggressor_side:
                  type: string
                  enum:
                    - BUY
                    - SELL
                  x-parser-schema-id: <anonymous-schema-237>
                order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-238>
                fee:
                  type: number
                  x-parser-schema-id: <anonymous-schema-239>
                order_type:
                  type: string
                  enum:
                    - LIMIT
                    - MARKET
                    - ALO
                    - TAKE_PROFIT
                    - STOP_LOSS
                    - STOP_MARKET
                  x-parser-schema-id: <anonymous-schema-240>
                tif:
                  type: string
                  enum:
                    - GTC
                    - IOC
                    - FOK
                  x-parser-schema-id: <anonymous-schema-241>
                order_price:
                  type: number
                  x-parser-schema-id: <anonymous-schema-242>
                client_order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-243>
                remaining_quantity:
                  type: number
                  x-parser-schema-id: <anonymous-schema-244>
                take_profit:
                  type: number
                  x-parser-schema-id: <anonymous-schema-245>
                stop_loss:
                  type: number
                  x-parser-schema-id: <anonymous-schema-246>
                execution_type:
                  type: string
                  x-parser-schema-id: <anonymous-schema-247>
                timestamp:
                  type: number
                  description: Timestamp in seconds with fractional part
                  x-parser-schema-id: <anonymous-schema-248>
                realised_pnl:
                  type: number
                  x-parser-schema-id: <anonymous-schema-249>
              x-parser-schema-id: FillResponse
          x-parser-schema-id: <anonymous-schema-230>
        title: Fill Response
        description: Response containing a single fill.
        example: |-
          {
            "fill_response": {
              "trade_id": "<string>",
              "user_id": "<string>",
              "symbol": "<string>",
              "price": 123,
              "quantity": 123,
              "side": "<string>",
              "aggressor_side": "<string>",
              "order_id": "<string>",
              "fee": 123,
              "order_type": "<string>",
              "tif": "<string>",
              "order_price": 123,
              "client_order_id": "<string>",
              "remaining_quantity": 123,
              "take_profit": 123,
              "stop_loss": 123,
              "execution_type": "<string>",
              "timestamp": 123,
              "realised_pnl": 123
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: fillResponse
      - &ref_59
        id: allOrdersResponse
        contentType: application/json
        payload:
          - name: All Orders Response
            description: Response containing a list of orders.
            type: object
            properties:
              - name: all_orders_response
                type: object
                required: false
                properties:
                  - name: orders
                    type: array
                    required: false
                  - name: twaps
                    type: array
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            all_orders_response:
              type: object
              properties:
                orders:
                  type: array
                  items: *ref_10
                  x-parser-schema-id: <anonymous-schema-251>
                twaps:
                  type: array
                  items:
                    type: object
                    properties:
                      twap_id:
                        type: string
                        x-parser-schema-id: <anonymous-schema-253>
                      client_twap_id:
                        type: string
                        nullable: true
                        x-parser-schema-id: <anonymous-schema-254>
                      user_id:
                        type: string
                        x-parser-schema-id: <anonymous-schema-255>
                      status:
                        type: string
                        x-parser-schema-id: <anonymous-schema-256>
                      symbol:
                        type: string
                        x-parser-schema-id: <anonymous-schema-257>
                      total_quantity:
                        type: number
                        x-parser-schema-id: <anonymous-schema-258>
                      filled_quantity:
                        type: number
                        x-parser-schema-id: <anonymous-schema-259>
                      average_fill_price:
                        type: number
                        x-parser-schema-id: <anonymous-schema-260>
                      total_num_orders:
                        type: integer
                        x-parser-schema-id: <anonymous-schema-261>
                      order_interval_secs:
                        type: integer
                        x-parser-schema-id: <anonymous-schema-262>
                      reduce_only:
                        type: boolean
                        x-parser-schema-id: <anonymous-schema-263>
                      side:
                        type: string
                        enum:
                          - BUY
                          - SELL
                        x-parser-schema-id: <anonymous-schema-264>
                      updated_at:
                        type: number
                        nullable: true
                        x-parser-schema-id: <anonymous-schema-265>
                      created_at:
                        type: number
                        nullable: true
                        x-parser-schema-id: <anonymous-schema-266>
                    x-parser-schema-id: TwapResponse
                  x-parser-schema-id: <anonymous-schema-252>
              x-parser-schema-id: AllOrdersResponse
          x-parser-schema-id: <anonymous-schema-250>
        title: All Orders Response
        description: Response containing a list of orders.
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: allOrdersResponse
      - &ref_60
        id: authenticatedResponse
        contentType: application/json
        payload:
          - name: Authenticated Response
            description: Response indicating authentication success.
            type: object
            properties:
              - name: authenticated
                type: boolean
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            authenticated:
              type: boolean
              x-parser-schema-id: <anonymous-schema-268>
          x-parser-schema-id: <anonymous-schema-267>
        title: Authenticated Response
        description: Response indicating authentication success.
        example: |-
          {
            "authenticated": true
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: authenticatedResponse
      - &ref_61
        id: userTradesResponse
        contentType: application/json
        payload:
          - name: User Trades Response
            description: Response containing user trades.
            type: object
            properties:
              - name: user_trades_response
                type: array
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            user_trades_response:
              type: array
              items:
                type: object
                properties:
                  trade_id:
                    type: string
                    x-parser-schema-id: <anonymous-schema-272>
                  symbol:
                    type: string
                    x-parser-schema-id: <anonymous-schema-273>
                  price:
                    type: number
                    x-parser-schema-id: <anonymous-schema-274>
                  quantity:
                    type: number
                    x-parser-schema-id: <anonymous-schema-275>
                  side:
                    type: string
                    enum:
                      - BUY
                      - SELL
                    x-parser-schema-id: <anonymous-schema-276>
                  order_id:
                    type: string
                    x-parser-schema-id: <anonymous-schema-277>
                  fee:
                    type: number
                    x-parser-schema-id: <anonymous-schema-278>
                  order_type:
                    type: string
                    enum:
                      - LIMIT
                      - MARKET
                      - ALO
                      - TAKE_PROFIT
                      - STOP_LOSS
                      - STOP_MARKET
                    x-parser-schema-id: <anonymous-schema-279>
                  tif:
                    type: string
                    enum:
                      - GTC
                      - IOC
                      - FOK
                    x-parser-schema-id: <anonymous-schema-280>
                x-parser-schema-id: TradePayload
              x-parser-schema-id: <anonymous-schema-271>
          x-parser-schema-id: <anonymous-schema-270>
        title: User Trades Response
        description: Response containing user trades.
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: userTradesResponse
      - &ref_62
        id: userLeverageResponse
        contentType: application/json
        payload:
          - name: User Leverage Response
            description: Response containing user leverage settings.
            type: object
            properties:
              - name: user_leverage_response
                type: array
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            user_leverage_response:
              type: array
              items: &ref_11
                type: object
                properties:
                  id:
                    type: string
                    x-parser-schema-id: <anonymous-schema-283>
                  symbol:
                    type: string
                    x-parser-schema-id: <anonymous-schema-284>
                  initial_margin:
                    type: number
                    x-parser-schema-id: <anonymous-schema-285>
                  maintenance_margin:
                    type: number
                    x-parser-schema-id: <anonymous-schema-286>
                  max_notional:
                    type: number
                    x-parser-schema-id: <anonymous-schema-287>
                  leverage:
                    type: string
                    x-parser-schema-id: <anonymous-schema-288>
                x-parser-schema-id: LeveragePublic
              x-parser-schema-id: <anonymous-schema-282>
          x-parser-schema-id: <anonymous-schema-281>
        title: User Leverage Response
        description: Response containing user leverage settings.
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: userLeverageResponse
      - &ref_63
        id: availableLeverageLevelsResponse
        contentType: application/json
        payload:
          - name: Available Leverage Levels Response
            description: Response containing available leverage levels.
            type: object
            properties:
              - name: available_leverage_levels_response
                type: array
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            available_leverage_levels_response:
              type: array
              items: *ref_11
              x-parser-schema-id: <anonymous-schema-290>
          x-parser-schema-id: <anonymous-schema-289>
        title: Available Leverage Levels Response
        description: Response containing available leverage levels.
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: availableLeverageLevelsResponse
      - &ref_64
        id: subscribedResponse
        contentType: application/json
        payload:
          - name: Subscribed Response
            description: Confirmation of subscription.
            type: object
            properties:
              - name: subscribed
                type: string
                enumValues:
                  - stop_orders
                  - positions
                  - balances
                  - order_responses
                  - fills
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            subscribed:
              type: string
              enum:
                - stop_orders
                - positions
                - balances
                - order_responses
                - fills
              x-parser-schema-id: <anonymous-schema-292>
          x-parser-schema-id: <anonymous-schema-291>
        title: Subscribed Response
        description: Confirmation of subscription.
        example: |-
          {
            "subscribed": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribedResponse
      - &ref_65
        id: unsubscribedResponse
        contentType: application/json
        payload:
          - name: Unsubscribed Response
            description: Confirmation of unsubscription.
            type: object
            properties:
              - name: unsubscribed
                type: string
                enumValues:
                  - stop_orders
                  - positions
                  - balances
                  - order_responses
                  - fills
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            unsubscribed:
              type: string
              enum:
                - stop_orders
                - positions
                - balances
                - order_responses
                - fills
              x-parser-schema-id: <anonymous-schema-294>
          x-parser-schema-id: <anonymous-schema-293>
        title: Unsubscribed Response
        description: Confirmation of unsubscription.
        example: |-
          {
            "unsubscribed": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribedResponse
      - &ref_66
        id: stopOrderResponse
        contentType: application/json
        payload:
          - name: Stop Order Response
            description: Response containing a stop order.
            type: object
            properties:
              - name: stop_order_response
                type: object
                required: false
                properties:
                  - name: stop_order_id
                    type: string
                    required: false
                  - name: user_id
                    type: string
                    required: false
                  - name: symbol
                    type: string
                    required: false
                  - name: price
                    type: number
                    required: false
                  - name: quantity
                    type: number
                    required: false
                  - name: direction
                    type: string
                    enumValues:
                      - BUY
                      - SELL
                    required: false
                  - name: stop_order_type
                    type: string
                    enumValues:
                      - TAKE_PROFIT
                      - STOP_LOSS
                    required: false
                  - name: client_order_id
                    type: string
                    required: false
                  - name: update_time
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            stop_order_response:
              type: object
              properties:
                stop_order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-296>
                user_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-297>
                symbol:
                  type: string
                  x-parser-schema-id: <anonymous-schema-298>
                price:
                  type: number
                  x-parser-schema-id: <anonymous-schema-299>
                quantity:
                  type: number
                  x-parser-schema-id: <anonymous-schema-300>
                direction:
                  type: string
                  enum:
                    - BUY
                    - SELL
                  x-parser-schema-id: <anonymous-schema-301>
                stop_order_type:
                  type: string
                  enum:
                    - TAKE_PROFIT
                    - STOP_LOSS
                  x-parser-schema-id: <anonymous-schema-302>
                client_order_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-303>
                update_time:
                  type: string
                  format: date-time
                  x-parser-schema-id: <anonymous-schema-304>
              x-parser-schema-id: StopOrder
          x-parser-schema-id: <anonymous-schema-295>
        title: Stop Order Response
        description: Response containing a stop order.
        example: |-
          {
            "stop_order_response": {
              "stop_order_id": "<string>",
              "user_id": "<string>",
              "symbol": "<string>",
              "price": 123,
              "quantity": 123,
              "direction": "<string>",
              "stop_order_type": "<string>",
              "client_order_id": "<string>",
              "update_time": "<string>"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: stopOrderResponse
      - &ref_67
        id: positionResponse
        contentType: application/json
        payload:
          - name: Position Response
            description: Response containing a position.
            type: object
            properties:
              - name: position_response
                type: object
                required: false
                properties:
                  - name: id
                    type: string
                    required: false
                  - name: symbol
                    type: string
                    required: false
                  - name: position
                    type: number
                    required: false
                  - name: margin_alloc
                    type: number
                    required: false
                  - name: realised_pnl
                    type: number
                    required: false
                  - name: unrealised_pnl
                    type: number
                    required: false
                  - name: net_funding
                    type: number
                    required: false
                  - name: open_orders
                    type: number
                    required: false
                  - name: open_quantity
                    type: number
                    required: false
                  - name: leverage
                    type: number
                    required: false
                  - name: initial_margin
                    type: number
                    required: false
                  - name: maintenance_margin
                    type: number
                    required: false
                  - name: average_price
                    type: number
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            position_response: *ref_12
          x-parser-schema-id: <anonymous-schema-305>
        title: Position Response
        description: Response containing a position.
        example: |-
          {
            "position_response": {
              "id": "<string>",
              "symbol": "<string>",
              "position": 123,
              "margin_alloc": 123,
              "realised_pnl": 123,
              "unrealised_pnl": 123,
              "net_funding": 123,
              "open_orders": 123,
              "open_quantity": 123,
              "leverage": 123,
              "initial_margin": 123,
              "maintenance_margin": 123,
              "average_price": 123
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: positionResponse
      - &ref_68
        id: balanceResponse
        contentType: application/json
        payload:
          - name: Balance Response
            description: Response containing a balance.
            type: object
            properties:
              - name: balance_response
                type: object
                required: false
                properties:
                  - name: id
                    type: string
                    required: false
                  - name: user_id
                    type: string
                    required: false
                  - name: deposit
                    type: number
                    required: false
                  - name: realised_pnl
                    type: number
                    required: false
                  - name: order_margin
                    type: number
                    required: false
                  - name: position_margin
                    type: number
                    required: false
                  - name: unrealised_pnl
                    type: number
                    required: false
                  - name: net_funding
                    type: number
                    required: false
                  - name: available_balance
                    type: number
                    required: false
                  - name: referral_rewards
                    type: number
                    required: false
                  - name: fees
                    type: number
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            balance_response: *ref_13
          x-parser-schema-id: <anonymous-schema-306>
        title: Balance Response
        description: Response containing a balance.
        example: |-
          {
            "balance_response": {
              "id": "<string>",
              "user_id": "<string>",
              "deposit": 123,
              "realised_pnl": 123,
              "order_margin": 123,
              "position_margin": 123,
              "unrealised_pnl": 123,
              "net_funding": 123,
              "available_balance": 123,
              "referral_rewards": 123,
              "fees": 123
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: balanceResponse
      - &ref_69
        id: ackResponse
        contentType: application/json
        payload:
          - name: Acknowledgment Response
            description: General acknowledgment.
            type: object
            properties:
              - name: ack
                type: object
                required: false
                properties:
                  - name: incoming_message
                    type: object
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            ack:
              type: object
              properties:
                incoming_message:
                  type: object
                  x-parser-schema-id: <anonymous-schema-308>
              x-parser-schema-id: AckResponse
          x-parser-schema-id: <anonymous-schema-307>
        title: Acknowledgment Response
        description: General acknowledgment.
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: ackResponse
      - &ref_70
        id: errorResponse
        contentType: application/json
        payload:
          - name: Error Response
            description: Error response.
            type: object
            properties:
              - name: err
                type: object
                required: false
                properties:
                  - name: error_code
                    type: string
                    enumValues:
                      - RateLimited
                      - InvalidJSONFormat
                      - AlreadyAuthenticated
                      - InvalidParameter
                      - PermissionDenied
                      - ServerError
                      - InvalidOrder
                      - KycRequired
                      - TncRequired
                    required: false
                  - name: message
                    type: string
                    required: false
                  - name: oneOf
                    type: oneOf
                    description: Must be one of these types
                    properties:
                      - name: type
                        type: string
                        description: object
                        required: false
                      - name: type
                        type: string
                        description: string
                        required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            err:
              type: object
              properties:
                error_code:
                  type: string
                  enum:
                    - RateLimited
                    - InvalidJSONFormat
                    - AlreadyAuthenticated
                    - InvalidParameter
                    - PermissionDenied
                    - ServerError
                    - InvalidOrder
                    - KycRequired
                    - TncRequired
                  x-parser-schema-id: <anonymous-schema-310>
                message:
                  type: string
                  nullable: true
                  x-parser-schema-id: <anonymous-schema-311>
                incoming_message:
                  oneOf:
                    - type: object
                      x-parser-schema-id: <anonymous-schema-313>
                    - type: string
                      x-parser-schema-id: <anonymous-schema-314>
                  x-parser-schema-id: <anonymous-schema-312>
              required:
                - error_code
              x-parser-schema-id: ErrResponse
          x-parser-schema-id: <anonymous-schema-309>
        title: Error Response
        description: Error response.
        example: |-
          {
            "err": {
              "error_code": "<string>",
              "message": "<string>"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: errorResponse
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_14
  - *ref_15
  - *ref_16
  - *ref_17
  - *ref_18
  - *ref_19
  - *ref_20
  - *ref_21
  - *ref_22
  - *ref_23
  - *ref_24
  - *ref_25
  - *ref_26
  - *ref_27
  - *ref_28
  - *ref_29
  - *ref_30
  - *ref_31
  - *ref_32
  - *ref_33
receiveOperations:
  - *ref_34
sendMessages:
  - *ref_35
  - *ref_36
  - *ref_37
  - *ref_38
  - *ref_39
  - *ref_40
  - *ref_41
  - *ref_42
  - *ref_43
  - *ref_44
  - *ref_45
  - *ref_46
  - *ref_47
  - *ref_48
  - *ref_49
  - *ref_50
  - *ref_51
  - *ref_52
  - *ref_53
  - *ref_54
receiveMessages:
  - *ref_55
  - *ref_56
  - *ref_57
  - *ref_58
  - *ref_59
  - *ref_60
  - *ref_61
  - *ref_62
  - *ref_63
  - *ref_64
  - *ref_65
  - *ref_66
  - *ref_67
  - *ref_68
  - *ref_69
  - *ref_70
extensions:
  - id: x-parser-unique-object-id
    value: qfex
securitySchemes:
  - id: PublicKeyQuery
    name: api_key
    type: httpApiKey
    description: Provide your public key as a query parameter (?api_key=...).
    in: query
    extensions: []
  - id: JwtQuery
    name: jwt
    type: httpApiKey
    description: Provide your JWT as a query parameter (?jwt=...).
    in: query
    extensions: []

````