Skip to main content

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

ParameterTypeComments
idstringMessage id.
topicstringTopic name
typestringData type. snapshot
tsnumberThe timestamp (ms) that the system generates the data
dataarrayObject. The element in the array is sort by matching time in ascending order
> TnumberThe timestamp (ms) that the order is filled
> sstringSymbol name
> SstringSide of taker. Buy,Sell
> vstringTrade size
> pstringTrade price
> LstringDirection of price change. Unique field for future
> istringTrade ID

Subscribe Example

const socket = new WebSocket('wss://stream-testnet.zoomex.com/v3/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
}
]
}