> For the complete documentation index, see [llms.txt](https://docs.infoway.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.infoway.io/en-docs/websocket/websocket-subscribe-method/latest-trade-subscription.md).

# Latest Trade Subscription

Real-time trade ticks over WebSocket.

### Overview

Subscribe to continuous trade updates (price, size, direction, timestamp) for equities, crypto, forex, and futures.

The field name is **`includeTy`**. The server does not read `includeType`.

### Request frequency

Each connection allows 60 frames per minute in total (subscribe, unsubscribe, heartbeat). See [WebSocket Limitation](/en-docs/getting-started/api-limitation/websocket-limitation.md). Exceeding the limit closes the socket. Repeated abuse may ban the API key.

### Error codes

See [WebSocket Error Codes](/en-docs/getting-started/error-codes/websocket-error-codes.md).

### Subscription address

See [Endpoints](/en-docs/getting-started/endpoints.md).

### Request (protocol 10000)

```json
{
    "code": 10000,
    "trace": "423afec425004bd8a5e02e1ba5f9b2b0",
    "data": {
        "codes": "BTCUSDT",
        "includeTy": false
    }
}
```

| Parameter   | Type    | Required | Description                                                                       | Example                            |
| ----------- | ------- | -------- | --------------------------------------------------------------------------------- | ---------------------------------- |
| `code`      | Integer | Yes      | Subscribe protocol                                                                | `10000`                            |
| `trace`     | String  | Yes      | Trace id                                                                          | `423afec425004bd8a5e02e1ba5f9b2b0` |
| `data`      | JSON    | Yes      | Subscription body                                                                 |                                    |
| `codes`     | String  | Yes      | Comma-separated symbols (up to 600 per connection)                                | `BTCUSDT`                          |
| `includeTy` | Boolean | No       | When `true`, pushes include the trade-type field `ty`. Omit or `false` omits `ty` | `false`                            |

### Response (protocol 10001)

```json
{
    "code": 10001,
    "trace": "423afec425004bd8a5e02e1ba5f9b2b0",
    "msg": "ok"
}
```

`msg=ok` only means the frame was accepted. A `business` that does not match the symbol market can still ack and then never push.

| Parameter | Type    | Required | Description               | Example                            |
| --------- | ------- | -------- | ------------------------- | ---------------------------------- |
| `code`    | Integer | Yes      | Ack protocol              | `10001`                            |
| `trace`   | String  | Yes      | Echo of the request trace | `423afec425004bd8a5e02e1ba5f9b2b0` |
| `msg`     | String  | Yes      | `ok`                      | `ok`                               |

### Push (protocol 10002)

```json
{
    "code": 10002,
    "data": {
        "p": "103482.94",
        "s": "BTCUSDT",
        "t": 1747552358393,
        "td": 2,
        "v": "0.00096",
        "vw": "99.3436224"
    }
}
```

| Parameter | Type    | Required | Description                                          | Example         |
| --------- | ------- | -------- | ---------------------------------------------------- | --------------- |
| `code`    | Integer | Yes      | Push protocol                                        | `10002`         |
| `data`    | JSON    | Yes      | Tick                                                 |                 |
| `s`       | String  | Yes      | Symbol                                               | `BTCUSDT`       |
| `p`       | String  | Yes      | Price                                                | `103482.94`     |
| `t`       | Long    | Yes      | Trade timestamp (milliseconds)                       | `1747552358393` |
| `td`      | Integer | Yes      | `0` default, `1` buy, `2` sell                       | `2`             |
| `v`       | String  | Yes      | Volume                                               | `0.00096`       |
| `vw`      | String  | Yes      | **Turnover / trade value** (not VWAP)                | `99.3436224`    |
| `ty`      | String  | No       | Exchange trade type; only when `includeTy` is `true` |                 |

### Transaction types

#### Hong Kong

* `*` Off-exchange
* `D` Odd lot
* `M` Non-automatic matching
* `P` Pre-market matching
* `U` Auction
* `X` Same-broker non-automatic
* `Y` Same-broker automatic
* (blank) Automatic matching

#### US

* (blank) Automatic matching
* `A` Acquisition
* `B` Block
* `D` Allocation
* `F` Intermarket sweep
* `G` Block sell
* `H` Away-from-market
* `I` Odd lot
* `K` NYSE Rule 155
* `M` Exchange close
* `P` Prior reference
* `Q` Exchange open
* `S` Split
* `V` Contingent
* `W` Average price
* `X` Cross-market
* `1` Restricted stock (regular hours)
