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).
| Field | Type | Description |
|---|---|---|
filter | string | Market ID (e.g. "BTC-PERP") |
data[].id | string | Unique trade identifier |
data[].mkr_sd | string | Maker side: "ORDER_SIDE_BUY" or "ORDER_SIDE_SELL" |
data[].px | string | Execution price |
data[].sz | string | Executed size in base asset |
data[].quote_sz | string | Executed size in quote asset |
data[].ts | string | Trade timestamp in nanoseconds |
ts | string | Message envelope timestamp in nanoseconds |
gsn | number | Global sequence number |