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

# Tick-by-Tick Trades (Trade)

## Plan Access

| Plan | Available |
| - | :-: |
| Free | ❌ |
| Starter | ✅ |
| Professional | ✅ |
| Full-Market Plans (A-Shares, HK Stocks, US Stocks) | ✅ |
| Enterprise | ✅ |

## Supported Markets

Supported markets: US Stocks, HK Stocks, A-Shares, China Futures, Hong Kong Futures, Crypto

## Subscribe

```json theme={null}
{
  "cmd": "subscribe",
  "data": {
    "channel": "trade",
    "symbols": ["700.HK", "BTCUSDT"]
  }
}
```

> `type` applies to every symbol in that subscription. Omit it when subscribing to mixed product types. If a symbol is ambiguous, split the request by product type and pass the corresponding value.

## Unsubscribe

```json theme={null}
{
  "cmd": "unsubscribe",
  "data": {
    "channel": "trade",
    "symbols": ["700.HK"]
  }
}
```

## Server Response

HK stocks, US stocks, and cryptocurrencies use the trade-array structure:

```json theme={null}
{
  "cmd": "trade",
  "data": {
    "symbol": "700.HK",
    "type": "stock",
    "trades": [
      {
        "id": "20950",
        "price": "553.000",
        "quantity": "100",
        "side": "buy",
        "timestamp": 1773371154000
      }
    ]
  }
}
```

A-shares, China futures, and Hong Kong futures push one trade per message, with fields directly under `data`. A-share example:

```json theme={null}
{
  "cmd": "trade",
  "data": {
    "symbol": "600519.SH",
    "type": "stock",
    "price": "1252.48",
    "quantity": "7",
    "side": "sell",
    "timestamp": 1789958062000
  }
}
```

Hong Kong futures also include a trade ID:

```json theme={null}
{
  "cmd": "trade",
  "data": {
    "id": "7687812613106827271",
    "symbol": "HSI8888",
    "type": "futures",
    "price": "24907",
    "quantity": "1",
    "side": "buy",
    "timestamp": 1789958359020
  }
}
```

China futures may also include position metadata:

```json theme={null}
{
  "cmd": "trade",
  "data": {
    "symbol": "BU2609",
    "type": "futures",
    "price": "4309",
    "quantity": "1",
    "side": "sell",
    "timestamp": 1784012398000,
    "open_interest_change": 0,
    "position_effect": "short_transfer"
  }
}
```

### Fields

| Field | Type | Description |
| - | - | - |
| data.symbol | string | Trading symbol |
| data.type | string | Product type |
| data.trades | array | Trade records; returned for HK stocks, US stocks, and cryptocurrencies |
| data.trades\[].id | string | Trade ID |
| data.trades\[].price | string | Trade price |
| data.trades\[].quantity | string | Trade quantity |
| data.trades\[].side | string | `buy`, `sell`, or `neutral` |
| data.trades\[].timestamp | int | Trade timestamp in milliseconds |
| data.id | string | Trade ID; returned for Hong Kong futures |
| data.price | string | Single-trade price; returned for A-shares, China futures, and Hong Kong futures |
| data.quantity | string | Single-trade quantity; returned for A-shares, China futures, and Hong Kong futures |
| data.side | string | Single-trade side; returned for A-shares, China futures, and Hong Kong futures |
| data.timestamp | int | Single-trade timestamp in milliseconds; returned for A-shares, China futures, and Hong Kong futures |
| data.open\_interest\_change | int \| null | Change in open interest; returned for China futures when available |
| data.position\_effect | string | Position effect; returned for China futures when available: `long_open`, `short_open`, `both_open`, `long_close`, `short_close`, `both_close`, `long_transfer`, or `short_transfer` |


## AsyncAPI

````yaml asyncapi.en.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: Tick-by-Tick Trade 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
                      - crypto
                    required: true
                  - name: trades
                    type: array
                    description: >-
                      Trade records for HK stocks, US stocks, and
                      cryptocurrencies
                    required: true
                    properties:
                      - name: id
                        type: string
                        description: Trade ID
                        required: true
                      - 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: id
                    type: string
                    description: Trade ID; returned for Hong Kong futures
                    required: false
                  - name: symbol
                    type: string
                    description: Trading symbol
                    required: true
                  - name: type
                    type: string
                    description: Symbol type
                    enumValues:
                      - stock
                      - futures
                    required: true
                  - 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; returned for China futures when
                      available
                    required: false
                  - name: position_effect
                    type: string
                    description: Position effect; returned for China futures when available
                    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-95>
            data:
              oneOf:
                - type: object
                  additionalProperties: false
                  properties:
                    symbol:
                      type: string
                      example: 700.HK
                      description: Trading symbol
                      x-parser-schema-id: <anonymous-schema-98>
                    type:
                      type: string
                      enum:
                        - stock
                        - crypto
                      description: Symbol type
                      x-parser-schema-id: <anonymous-schema-99>
                    trades:
                      type: array
                      description: >-
                        Trade records for HK stocks, US stocks, and
                        cryptocurrencies
                      items:
                        type: object
                        additionalProperties: false
                        properties:
                          id:
                            type: string
                            description: Trade ID
                            x-parser-schema-id: <anonymous-schema-102>
                          price:
                            type: string
                            description: Trade execution price
                            x-parser-schema-id: <anonymous-schema-103>
                          quantity:
                            type: string
                            description: Trade quantity
                            x-parser-schema-id: <anonymous-schema-104>
                          side:
                            type: string
                            enum:
                              - buy
                              - sell
                              - neutral
                            description: Trade side
                            x-parser-schema-id: <anonymous-schema-105>
                          timestamp:
                            type: integer
                            description: Unix timestamp in milliseconds
                            x-parser-schema-id: <anonymous-schema-106>
                        required:
                          - id
                          - price
                          - quantity
                          - side
                          - timestamp
                        x-parser-schema-id: <anonymous-schema-101>
                      x-parser-schema-id: <anonymous-schema-100>
                  required:
                    - symbol
                    - type
                    - trades
                  x-parser-schema-id: <anonymous-schema-97>
                - type: object
                  additionalProperties: false
                  properties:
                    id:
                      type: string
                      description: Trade ID; returned for Hong Kong futures
                      x-parser-schema-id: <anonymous-schema-108>
                    symbol:
                      type: string
                      example: 600519.SH
                      description: Trading symbol
                      x-parser-schema-id: <anonymous-schema-109>
                    type:
                      type: string
                      enum:
                        - stock
                        - futures
                      description: Symbol type
                      x-parser-schema-id: <anonymous-schema-110>
                    price:
                      type: string
                      example: '1252.48'
                      description: Trade execution price
                      x-parser-schema-id: <anonymous-schema-111>
                    quantity:
                      type: string
                      example: '7'
                      description: Trade quantity
                      x-parser-schema-id: <anonymous-schema-112>
                    side:
                      type: string
                      enum:
                        - buy
                        - sell
                        - neutral
                      example: sell
                      description: Trade side
                      x-parser-schema-id: <anonymous-schema-113>
                    timestamp:
                      type: integer
                      example: 1789958062000
                      description: Unix timestamp in milliseconds
                      x-parser-schema-id: <anonymous-schema-114>
                    open_interest_change:
                      type: *ref_0
                      description: >-
                        Change in open interest; returned for China futures when
                        available
                      x-parser-schema-id: <anonymous-schema-115>
                    position_effect:
                      type: string
                      enum:
                        - long_open
                        - short_open
                        - both_open
                        - long_close
                        - short_close
                        - both_close
                        - long_transfer
                        - short_transfer
                      description: >-
                        Position effect; returned for China futures when
                        available
                      x-parser-schema-id: <anonymous-schema-116>
                  required:
                    - symbol
                    - type
                    - price
                    - quantity
                    - side
                    - timestamp
                  x-parser-schema-id: <anonymous-schema-107>
              x-parser-schema-id: <anonymous-schema-96>
          required:
            - cmd
            - data
          x-parser-schema-id: <anonymous-schema-94>
        title: Tick-by-Tick Trade Data
        description: Real-time trade execution data pushed from server
        example: No examples found
        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 Tick-by-Tick 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-88>
            data:
              type: object
              additionalProperties: false
              properties:
                channel:
                  type: string
                  enum:
                    - ticker
                    - depth
                    - trade
                  default: trade
                  description: Channel name
                  x-parser-schema-id: <anonymous-schema-90>
                symbols:
                  type: array
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-92>
                  examples: *ref_1
                  description: List of trading symbols to subscribe/unsubscribe
                  x-parser-schema-id: <anonymous-schema-91>
                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-93>
              required:
                - channel
                - symbols
              x-parser-schema-id: <anonymous-schema-89>
          required:
            - cmd
            - data
          x-parser-schema-id: <anonymous-schema-87>
        title: Subscribe/Unsubscribe to Tick-by-Tick 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: []

````

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