WebSocket API

Trade Channel

Real-time trade prints per market

Channel name: trade

Subscription

{ "op": "sub", "channel": "trade", "params": { "market": "BTC-PERP" } }

params.market is optional. Omit to receive trades for all markets.

Message Types

Only order-book trades are published — OTC fills do not appear on this channel.

Snapshot

On subscribe, the server sends the last 50 trades (newest first) as an array:

{
  "channel": "trade",
  "filter": "BTC-PERP",
  "type": "snapshot",
  "data": [
    {
      "id": "0xabc...",
      "mkr_sd": "ORDER_SIDE_BUY",
      "px": "50000.00",
      "sz": "0.5",
      "quote_sz": "25000.00",
      "ts": "1234567880000000000"
    },
    {
      "id": "0xdef...",
      "mkr_sd": "ORDER_SIDE_SELL",
      "px": "49990.00",
      "sz": "0.2",
      "quote_sz": "9998.00",
      "ts": "1234567870000000000"
    }
  ],
  "gsn": 12340,
  "ts": "1234567880000000000"
}

If no recent trades exist, data is an empty array [].

Update

Each update contains an array of trades from the same execution event:

{
  "channel": "trade",
  "filter": "BTC-PERP",
  "type": "update",
  "data": [
    {
      "id": "0x1234...",
      "mkr_sd": "ORDER_SIDE_BUY",
      "px": "50000.00",
      "sz": "0.5",
      "quote_sz": "25000.00",
      "ts": "1234567890000000000"
    },
    {
      "id": "0x5678...",
      "mkr_sd": "ORDER_SIDE_BUY",
      "px": "49999.50",
      "sz": "0.3",
      "quote_sz": "14999.85",
      "ts": "1234567890000000000"
    }
  ],
  "gsn": 12345,
  "ts": "1234567890000000000"
}

Fields

data is always an array of trade objects (both snapshot and update).

FieldTypeDescription
filterstringMarket ID (e.g. "BTC-PERP")
data[].idstringUnique trade identifier
data[].mkr_sdstringMaker side: "ORDER_SIDE_BUY" or "ORDER_SIDE_SELL"
data[].pxstringExecution price
data[].szstringExecuted size in base asset
data[].quote_szstringExecuted size in quote asset
data[].tsstringTrade timestamp in nanoseconds
tsstringMessage envelope timestamp in nanoseconds
gsnnumberGlobal sequence number

On this page