Skip to main content

Execution

Subscribe to the execution stream to see your executions in real-time.

tip

You may have multiple executions for one order in a single message.

Topic: execution

All-In-One Topic: execution
Categorised Topic: execution.spot, execution.linear, execution.inverse

info
  • All-In-One topic and Categorised topic cannot be in the same subscription request
  • All-In-One topic: Allow you to listen to all categories (spot, linear, inverse) websocket updates
  • Categorised Topic: Allow you to listen only to specific category websocket updates

Response Parameters

ParameterTypeComments
idstringMessage ID
topicstringTopic name
creationTimenumberData created timestamp (ms)
dataarrayObject
> categorystringProduct type
  • Normal account: linear, inverse.
> symbolstringSymbol name
> orderIdstringOrder ID
> orderLinkIdstringUser customized order ID
> sidestringSide. Buy,Sell
> orderPricestringOrder price.
> orderQtystringOrder qty.
> leavesQtystringThe remaining qty not executed.
> orderTypestringOrder type. Market,Limit
> stopOrderTypestringStop order type. If the order is not stop order, any type is not returned.
> execFeestringExecuted trading fee.
> execIdstringExecution ID
> execPricestringExecution price
> execQtystringExecution qty
> execTypestringExecuted type.
> execValuestringExecuted order value.
> execTimestringExecuted timestamp(ms)
> isMakerbooleanIs maker order. true: maker, false: taker
> feeRatestringTrading fee rate.
> closedSizestringClosed position size

Subscribe Example

{
"op": "subscribe",
"args": [
"execution"
]
}
var url = require('url');
var WebSocket = require('ws');
var crypto = require('crypto');
var endpoint = "wss://stream-testnet.zoomex.com/v3/private"
console.log('attempting to connect to WebSocket %j', endpoint);
var client = new WebSocket(endpoint);
const apiKey="XXXXXXXXX";
const apiSecret="XXXXXXXXX";
client.on('open', function () {
console.log('"open" event!');
console.log('WebSocket Client Connected');
const expires = new Date().getTime() + 10000;
const signature = crypto.createHmac("sha256", apiSecret).update("GET/realtime" + expires).digest("hex");
const payload={
op: "auth",
args: [apiKey, expires.toFixed(0), signature],
}
client.send(JSON.stringify(payload));
setInterval(()=>{client.ping()}, 30000);
client.ping();
client.send(JSON.stringify({"op": "subscribe", "args": ['execution']}));
});

client.on('message', function (data) {
console.log('"message" event! %j', JSON.parse(Buffer.from(data).toString()));
});
client.on('ping', function (data, flags) {
console.log("ping received");
});
client.on('pong', function (data, flags) {
console.log("pong received");
});

Stream Example

{
"id": "592324803b2785-26fa-4214-9963-bdd4727f07be",
"topic": "execution",
"creationTime": 1672364174455,
"data": [
{
"category": "linear",
"symbol": "XRPUSDT",
"execFee": "0.005061",
"execId": "7e2ae69c-4edf-5800-a352-893d52b446aa",
"execPrice": "0.3374",
"execQty": "25",
"execType": "Trade",
"execValue": "8.435",
"isMaker": false,
"feeRate": "0.0006",
"leavesQty": "0",
"orderId": "f6e324ff-99c2-4e89-9739-3086e47f9381",
"orderLinkId": "",
"orderPrice": "0.3207",
"orderQty": "25",
"orderType": "Market",
"stopOrderType": "UNKNOWN",
"side": "Sell",
"execTime": "1672364174443",
"closedSize": ""
}
]
}