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

# Trades

> Trades WebSocket subscription and response reference.

Connect to `wss://mainnet-ws1.bulk.trade`, then send the subscription below. All channels share the same socket; the page name is not a separate endpoint path. The playground sends read-only subscription messages.

Real-time trades feed

```json Subscribe theme={null}
{
  "method": "subscribe",
  "subscription": [{
    "type": "trades",
    "symbol": "BTC-USD"
  }]
}
```

```json Response theme={null}
{
  "type": "subscriptionResponse",
  "topics": ["trades.BTC-USD"]
}
```

```json Update theme={null}
{
  "type": "trades",
  "data": {
    "trades": [
      {
        "s": "BTC-USD",
        "px": 102500.0,
        "sz": 0.15,
        "time": 1699564800000,
        "side": true,
        "maker": "9J8TUdEWrrcADK913r1Cs7DdqX63VdVU88imfDzT1ypt",
        "taker": "5Am6JkEHAjYG1itNWRMGpQrxvY8AaqkXCo1TZvenqVux",
        "maker_fee": 0.3075,
        "taker_fee": -4.6125,
        "reason_code": 0
      }
    ]
  },
  "topic": "trades.BTC-USD"
}
```

**Initial Response**: None (stateless)

**Updates**: Real-time on every fill

**Trade Fields**:

| Field | Description |
| - | - |
| `s` | Symbol (market) |
| `px` | Execution price |
| `sz` | Size traded |
| `time` | Timestamp (milliseconds) |
| `side` | `true` if taker bought, `false` if taker sold |
| `maker` | Maker public key (base58) |
| `taker` | Taker public key (base58) |
| `maker_fee` | Effective maker fee in settlement currency; negative is a charge and positive is a rebate |
| `taker_fee` | Effective taker fee in settlement currency; negative is a charge and positive is a rebate |
| `reason_code` | `0=normal`, `1=liquidation`, `2=adl`, `3=liquidation_sweep`, `4=market_closed` |
| `reason` | Omitted for normal trades; otherwise `"liquidation"`, `"adl"`, `"liquidation_sweep"`, or `"market_closed"` |

This public market-data message does not include `tradeId`. Public
[account fill updates](https://docs.bulk.trade/api-reference/ws-account/fills.md) expose that
execution ID. [`POST /account` fill history](https://docs.bulk.trade/api-reference/getAccount#history-queries)
does not return `tradeId`; use its `slot`, `sequence`, `orderIdMaker`, and
`orderIdTaker` fields when reconciling historical rows.

Join the REST `slot` and `sequence` values with a colon to match the account
WebSocket `tradeId` on the same network.

## Connection and Limits

See [connection management](https://docs.bulk.trade/api-reference/ws-connection.md) for reconnect behavior and [public rate limits](https://docs.bulk.trade/api-reference/rate-limits.md) for connection budgets.


## AsyncAPI

````yaml api-reference/asyncapi.yaml trades
id: trades
title: Trades
description: >-
  Public fills only; no initial snapshot or historical replay. time is
  milliseconds; side=true means taker buy. No tradeId in this stream. Connect,
  then send subscribe; unsubscribe uses the acknowledged topic. Unsubscribe
  using the acknowledged topic; see [Connection
  Management](/api-reference/ws-connection#unsubscribe).
servers:
  - id: mainnet
    protocol: wss
    host: mainnet-ws1.bulk.trade
    bindings: []
    variables: []
  - id: testnet
    protocol: wss
    host: exchange-ws1.bulk.trade
    bindings: []
    variables: []
address: /
parameters: []
bindings: []
operations:
  - &ref_1
    id: tradesSubscribe
    title: Trades subscribe
    type: receive
    messages:
      - &ref_3
        id: subscribe
        contentType: application/json
        payload:
          - name: Trades subscribe
            description: >-
              Schema defaults on this request are playground example prefills,
              not omitted-field defaults accepted by the network endpoint.
            type: object
            properties:
              - name: method
                type: string
                enumValues:
                  - subscribe
                required: true
              - name: subscription
                type: array
                description: >-
                  Playground example prefill. Send the subscription array
                  explicitly; this is not a network-side default.
                required: true
                properties:
                  - name: type
                    type: string
                    enumValues:
                      - trades
                    required: true
                  - name: symbol
                    type: string
                    description: Playground example prefill; not a network-side default.
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            method:
              type: string
              enum:
                - subscribe
              default: subscribe
              x-parser-schema-id: <anonymous-schema-68>
            subscription:
              type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - trades
                    default: trades
                    x-parser-schema-id: <anonymous-schema-71>
                  symbol:
                    type: string
                    default: BTC-USD
                    description: Playground example prefill; not a network-side default.
                    x-parser-schema-id: <anonymous-schema-72>
                required:
                  - type
                  - symbol
                x-parser-schema-id: <anonymous-schema-70>
              minItems: 1
              default:
                - type: trades
                  symbol: BTC-USD
              description: >-
                Playground example prefill. Send the subscription array
                explicitly; this is not a network-side default.
              x-parser-schema-id: <anonymous-schema-69>
          required:
            - method
            - subscription
          x-parser-schema-id: <anonymous-schema-67>
        title: Trades subscribe
        description: >-
          Schema defaults on this request are playground example prefills, not
          omitted-field defaults accepted by the network endpoint.
        example: |-
          {
            "method": "subscribe",
            "subscription": [
              {
                "type": "trades",
                "symbol": "BTC-USD"
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribe
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: trades
  - &ref_2
    id: tradesEvents
    title: Trades events
    type: send
    messages:
      - &ref_4
        id: trades
        contentType: application/json
        payload:
          - name: Trades trades
            description: Network-published trades
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - trades
                required: true
              - name: data
                type: object
                required: true
                properties:
                  - name: trades
                    type: array
                    required: false
                    properties:
                      - name: s
                        type: string
                        required: false
                      - name: px
                        type: number
                        required: false
                      - name: sz
                        type: number
                        required: false
                      - name: time
                        type: number
                        description: Unix timestamp in milliseconds.
                        required: false
                      - name: side
                        type: boolean
                        required: false
                      - name: maker
                        type: string
                        required: false
                      - name: taker
                        type: string
                        required: false
                      - name: maker_fee
                        type: number
                        description: >-
                          Maker fee in settlement currency; negative is a charge
                          and positive is a rebate.
                        required: false
                      - name: taker_fee
                        type: number
                        description: >-
                          Taker fee in settlement currency; negative is a charge
                          and positive is a rebate.
                        required: false
                      - name: reason_code
                        type: number
                        required: false
              - name: topic
                type: string
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - trades
              x-parser-schema-id: <anonymous-schema-74>
            data:
              type: object
              properties:
                trades:
                  type: array
                  items:
                    type: object
                    properties:
                      s:
                        type: string
                        x-parser-schema-id: <anonymous-schema-78>
                      px:
                        type: number
                        x-parser-schema-id: <anonymous-schema-79>
                      sz:
                        type: number
                        x-parser-schema-id: <anonymous-schema-80>
                      time:
                        type: number
                        description: Unix timestamp in milliseconds.
                        x-parser-schema-id: <anonymous-schema-81>
                      side:
                        type: boolean
                        x-parser-schema-id: <anonymous-schema-82>
                      maker:
                        type: string
                        x-parser-schema-id: <anonymous-schema-83>
                      taker:
                        type: string
                        x-parser-schema-id: <anonymous-schema-84>
                      maker_fee:
                        type: number
                        description: >-
                          Maker fee in settlement currency; negative is a charge
                          and positive is a rebate.
                        x-parser-schema-id: <anonymous-schema-85>
                      taker_fee:
                        type: number
                        description: >-
                          Taker fee in settlement currency; negative is a charge
                          and positive is a rebate.
                        x-parser-schema-id: <anonymous-schema-86>
                      reason_code:
                        type: number
                        x-parser-schema-id: <anonymous-schema-87>
                    x-parser-schema-id: <anonymous-schema-77>
                  x-parser-schema-id: <anonymous-schema-76>
              x-parser-schema-id: <anonymous-schema-75>
            topic:
              type: string
              x-parser-schema-id: <anonymous-schema-88>
          required:
            - type
            - data
            - topic
          x-parser-schema-id: <anonymous-schema-73>
        title: Trades trades
        description: Network-published trades
        example: |-
          {
            "type": "trades",
            "data": {
              "trades": [
                {
                  "s": "BTC-USD",
                  "px": 102500,
                  "sz": 0.15,
                  "time": 1699564800000,
                  "side": true,
                  "maker": "9J8TUdEWrrcADK913r1Cs7DdqX63VdVU88imfDzT1ypt",
                  "taker": "5Am6JkEHAjYG1itNWRMGpQrxvY8AaqkXCo1TZvenqVux",
                  "maker_fee": 0.3075,
                  "taker_fee": -4.6125,
                  "reason_code": 0
                }
              ]
            },
            "topic": "trades.BTC-USD"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: trades
      - &ref_5
        id: subscribed
        contentType: application/json
        payload:
          - name: Trades subscribed
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - subscriptionResponse
                required: true
              - name: topics
                type: array
                required: false
                properties:
                  - name: item
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - subscriptionResponse
              x-parser-schema-id: <anonymous-schema-90>
            topics:
              type: array
              items:
                type: string
                x-parser-schema-id: <anonymous-schema-92>
              x-parser-schema-id: <anonymous-schema-91>
          required:
            - type
          x-parser-schema-id: <anonymous-schema-89>
        title: Trades subscribed
        example: |-
          {
            "type": "subscriptionResponse",
            "topics": [
              "trades.BTC-USD"
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribed
      - &ref_6
        id: unsubscribed
        contentType: application/json
        payload:
          - name: Trades unsubscribed
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - unsubscribeResponse
                required: true
              - name: topic
                type: string
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - unsubscribeResponse
              x-parser-schema-id: <anonymous-schema-94>
            topic:
              type: string
              x-parser-schema-id: <anonymous-schema-95>
          required:
            - type
          x-parser-schema-id: <anonymous-schema-93>
        title: Trades unsubscribed
        example: |-
          {
            "type": "unsubscribeResponse",
            "topic": "trades.BTC-USD"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribed
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
receiveOperations:
  - *ref_2
sendMessages:
  - *ref_3
receiveMessages:
  - *ref_4
  - *ref_5
  - *ref_6
extensions:
  - id: x-parser-unique-object-id
    value: trades
securitySchemes: []

````

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