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

# Trade



## AsyncAPI

````yaml asyncapi.json trade
id: trade
title: Trade
description: ''
servers:
  - id: production
    protocol: wss
    host: api.tickdb.ai
    bindings: []
    variables: []
address: /v1/realtime
parameters: []
bindings: []
operations:
  - &ref_4
    id: subscribeToTrade
    title: Subscribe to trade
    type: send
    messages:
      - &ref_6
        id: tradeData
        contentType: application/json
        payload:
          - name: Trade Execution Data
            description: Real-time trade execution data pushed from server
            type: object
            properties:
              - name: cmd
                type: string
                description: Message type
                required: true
              - name: data
                type: object
                required: true
                properties:
                  - name: symbol
                    type: string
                    description: Trading symbol
                    required: true
                  - name: type
                    type: string
                    description: Symbol type
                    enumValues:
                      - stock
                      - indices
                      - crypto
                      - forex
                      - futures
                    required: false
                  - name: price
                    type: string
                    description: Trade execution price
                    required: true
                  - name: quantity
                    type: string
                    description: Trade quantity
                    required: true
                  - name: side
                    type: string
                    description: Trade side
                    enumValues:
                      - buy
                      - sell
                      - neutral
                    required: true
                  - name: timestamp
                    type: integer
                    description: Unix timestamp in milliseconds
                    required: true
                  - name: open_interest_change
                    type: &ref_0
                      - integer
                      - 'null'
                    description: Change in open interest caused by this trade; futures only
                    required: false
                  - name: position_effect
                    type: string
                    description: Effect of the futures trade on positions; futures only
                    enumValues:
                      - long_open
                      - short_open
                      - both_open
                      - long_close
                      - short_close
                      - both_close
                      - long_transfer
                      - short_transfer
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          properties:
            cmd:
              type: string
              const: trade
              description: Message type
              x-parser-schema-id: <anonymous-schema-42>
            data:
              type: object
              additionalProperties: false
              properties:
                symbol:
                  type: string
                  example: AAPL.US
                  description: Trading symbol
                  x-parser-schema-id: <anonymous-schema-44>
                type:
                  type: string
                  enum:
                    - stock
                    - indices
                    - crypto
                    - forex
                    - futures
                  description: Symbol type
                  x-parser-schema-id: <anonymous-schema-45>
                price:
                  type: string
                  example: '150.25'
                  description: Trade execution price
                  x-parser-schema-id: <anonymous-schema-46>
                quantity:
                  type: string
                  example: '100'
                  description: Trade quantity
                  x-parser-schema-id: <anonymous-schema-47>
                side:
                  type: string
                  enum:
                    - buy
                    - sell
                    - neutral
                  example: buy
                  description: Trade side
                  x-parser-schema-id: <anonymous-schema-48>
                timestamp:
                  type: integer
                  example: 1703123456789
                  description: Unix timestamp in milliseconds
                  x-parser-schema-id: <anonymous-schema-49>
                open_interest_change:
                  type: *ref_0
                  description: Change in open interest caused by this trade; futures only
                  x-parser-schema-id: <anonymous-schema-50>
                position_effect:
                  type: string
                  enum:
                    - long_open
                    - short_open
                    - both_open
                    - long_close
                    - short_close
                    - both_close
                    - long_transfer
                    - short_transfer
                  description: Effect of the futures trade on positions; futures only
                  x-parser-schema-id: <anonymous-schema-51>
              required:
                - symbol
                - price
                - quantity
                - side
                - timestamp
              x-parser-schema-id: <anonymous-schema-43>
          required:
            - cmd
            - data
          x-parser-schema-id: <anonymous-schema-41>
        title: Trade Execution Data
        description: Real-time trade execution data pushed from server
        example: |-
          {
            "cmd": "<string>",
            "data": {
              "symbol": "<string>",
              "type": "<string>",
              "price": "<string>",
              "quantity": "<string>",
              "side": "<string>",
              "timestamp": 123,
              "position_effect": "<string>"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: tradeData
    bindings: []
    extensions: &ref_2
      - id: x-parser-unique-object-id
        value: trade
  - &ref_3
    id: receiveTradeData
    title: Receive trade data
    type: receive
    messages:
      - &ref_5
        id: subscribeRequest
        contentType: application/json
        payload:
          - name: Subscribe/Unsubscribe to Recent Trades
            description: Subscribe or unsubscribe to real-time trade execution updates
            type: object
            properties:
              - name: cmd
                type: string
                description: Command type (subscribe or unsubscribe)
                enumValues:
                  - subscribe
                  - unsubscribe
                required: true
              - name: data
                type: object
                required: true
                properties:
                  - name: channel
                    type: string
                    description: Channel name
                    enumValues:
                      - ticker
                      - depth
                      - trade
                    required: true
                  - name: symbols
                    type: array
                    description: List of trading symbols to subscribe/unsubscribe
                    examples: &ref_1
                      - AAPL.US
                      - 700.HK
                      - EURUSD
                      - XAUUSD
                      - BTCUSDT
                      - IC2606
                    required: true
                    properties:
                      - name: item
                        type: string
                        required: false
                  - name: type
                    type: string
                    description: >-
                      Symbol type, optional. Not required when the symbol is
                      unambiguous; if the server returns an AMBIGUOUS_SYMBOL
                      error, pass the value as indicated
                    enumValues:
                      - stock
                      - indices
                      - crypto
                      - forex
                      - futures
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          properties:
            cmd:
              type: string
              enum:
                - subscribe
                - unsubscribe
              description: Command type (subscribe or unsubscribe)
              x-parser-schema-id: <anonymous-schema-35>
            data:
              type: object
              additionalProperties: false
              properties:
                channel:
                  type: string
                  enum:
                    - ticker
                    - depth
                    - trade
                  default: trade
                  description: Channel name
                  x-parser-schema-id: <anonymous-schema-37>
                symbols:
                  type: array
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-39>
                  examples: *ref_1
                  description: List of trading symbols to subscribe/unsubscribe
                  x-parser-schema-id: <anonymous-schema-38>
                type:
                  type: string
                  enum:
                    - stock
                    - indices
                    - crypto
                    - forex
                    - futures
                  description: >-
                    Symbol type, optional. Not required when the symbol is
                    unambiguous; if the server returns an AMBIGUOUS_SYMBOL
                    error, pass the value as indicated
                  x-parser-schema-id: <anonymous-schema-40>
              required:
                - channel
                - symbols
              x-parser-schema-id: <anonymous-schema-36>
          required:
            - cmd
            - data
          x-parser-schema-id: <anonymous-schema-34>
        title: Subscribe/Unsubscribe to Recent Trades
        description: Subscribe or unsubscribe to real-time trade execution updates
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
    bindings: []
    extensions: *ref_2
sendOperations:
  - *ref_3
receiveOperations:
  - *ref_4
sendMessages:
  - *ref_5
receiveMessages:
  - *ref_6
extensions:
  - id: x-parser-unique-object-id
    value: trade
securitySchemes:
  - id: apiKey
    name: api_key
    type: httpApiKey
    in: query
    extensions: []

````