Trade
Subscribe to the recent trades stream.
After subscription, you will be pushed trade messages in real-time.
Push frequency: real-time
Topic:
publicTrade.{symbol}
Response Parameters
| Parameter | Type | Comments |
|---|---|---|
| id | string | Message id. |
| topic | string | Topic name |
| type | string | Data type. snapshot |
| ts | number | The timestamp (ms) that the system generates the data |
| data | array | Object. The element in the array is sort by matching time in ascending order |
| > T | number | The timestamp (ms) that the order is filled |
| > s | string | Symbol name |
| > S | string | Side of taker. Buy,Sell |
| > v | string | Trade size |
| > p | string | Trade price |
| > L | string | Direction of price change. Unique field for future |
| > i | string | Trade ID |
Subscribe Example
const socket = new WebSocket('wss://stream-testnet.zoomex.com/v5/public/linear');
socket.onopen = function() {
const subscribeMsg = {
"op": "subscribe",
"args": ["publicTrade.BTCUSDT"]
};
socket.send(JSON.stringify(subscribeMsg));
};
socket.onmessage = function(event) {
};
socket.onclose = function(event) {
};
Response Example
{
"topic": "publicTrade.BTCUSDT",
"type": "snapshot",
"ts": 1672304486868,
"data": [
{
"T": 1672304486865,
"s": "BTCUSDT",
"S": "Buy",
"v": "0.001",
"p": "16578.50",
"L": "PlusTick",
"i": "20f43950-d8dd-5b31-9112-a178eb6023af",
"BT": false
}
]
}