Skip to main content

WebSocket

Public and private channels are available at wss://<your-api-domain>/stream. You can connect with any WebSocket library. The examples use ws for Node.js. For a shorter guide with production tips, see Real-time Data.

Connecting​

Connection

const WebSocket = require('ws');

// Public channels only
const client = new WebSocket('wss://<your-api-domain>/stream');

// Or, for private channels, sign the connection (see below)
// const client = new WebSocket(
// `wss://<your-api-domain>/stream?api-key=${apiKey}&api-signature=${apiSignature}&api-expires=${apiExpires}`
// );

client.on('open', () => {
// Ping every 30 seconds to keep the connection alive
setInterval(() => {
client.send(JSON.stringify({ op: 'ping' }));
}, 30000);
});

Public channels don't need authentication. Private channels need an HMAC-SHA256 signature passed as query parameters, using the method CONNECT and the path /stream with no body. See WebSocket authentication.

The server closes a connection if no message is sent for one minute. To keep it alive, send a ping message about every 30 seconds.

PATH​

wss://<your-api-domain>/stream

PARAMETERS​

ParameterTypeRequired/OptionalDescription
api-keystringRequired for private channelsYour API key
api-signaturestringRequired for private channelsHMAC-SHA256 signature of CONNECT/stream + api-expires
api-expiresstringRequired for private channelsUnix timestamp (seconds) after which the signature expires

Sending/Receiving Messages​

Connection


client.send(
JSON.stringify({
op: OPERATION,
args: [EVENTS]
})
);

client.on('message', (data) => {
data = JSON.parse(data);
console.log(data);
})

Operations​

OperationDescription
subscribeSubscribe to events.
unsubscribeUnsubscribe to events.
pingPing-pong message for keeping connections alive.

Events​

EventsDescription
orderbookPublic event for orderbook updates.
tradePublic event for trade updates.
pricePublic event for price updates.
orderPrivate event for user order updates.
usertradePrivate event for user trades.
walletPrivate event for wallet balance updates.
stakePrivate event for user stake updates.
depositPrivate event for user deposits.
withdrawalPrivate event for user withdrawals.

Public Events​

Connection


client.on('open', () => {

// Subscribe
client.send(
JSON.stringify({
op: 'subscribe',
args: ['orderbook', 'trade']
})
);

// On message
client.on('message', (data) => {
console.log(JSON.parse(data));
});

// Later, to unsubscribe
client.send(
JSON.stringify({
op: 'unsubscribe',
args: ['orderbook', 'trade']
})
);
})

EVENTS​

The public events you can subscribe to are:

EventDescription
orderbookNotification with orderbook symbol and data update. To subscribe to a specific pair, you can pass the pair after a colon. Ex: orderbook:btc-usdt.
tradeNotification with trade data. To subscribe to a specific pair, you can pass the pair after a colon. Ex: trade:btc-usdt.
priceNotification with the latest prices (quoted in USDT) per currency and live price updates.

Public Updates​

orderbook


{
"topic": "orderbook",
"action": "partial",
"symbol": "btc-usdt",
"data": {
"bids": [
[60490, 0.05],
...
],
"asks": [
[60510, 0.08],
...
],
"timestamp": "2020-12-15T06:45:27.766Z"
},
"time": 1608015328
}

trades


{
"topic": "trade",
"action": "partial",
"symbol": "btc-usdt",
"data": [
{
"size": 0.012,
"price": 60500,
"side": "buy",
"timestamp": "2020-12-15T07:25:28.887Z"
},
...
],
"time": 1608015328
}

price


{
"topic": "price",
"action": "partial",
"data": {
"usdt": {
"price": 1.0007337033020485,
"lastUpdate": "2025-12-02T20:39:36.106Z"
},
"btc": {
"price": 88894.87428027151,
"lastUpdate": "2026-01-21T01:30:02.528Z"
},
"eth": {
"price": 4000,
"lastUpdate": "2026-01-21T01:40:47.510Z"
},
...
},
"time": 1768960063
}

{
"topic": "price",
"action": "update",
"symbol": "eth",
"data": {
"price": 4000,
"lastUpdate": "2026-01-21T01:50:19.501Z"
},
"time": 1768960220
}

Private Events​

Connection


client.on('open', () => {

// Subscribe
client.send(
JSON.stringify({
op: 'subscribe',
args: ['order', 'wallet']
})
);

// On message
client.on('message', (data) => {
console.log(JSON.parse(data));
});

// Later, to unsubscribe
client.send(
JSON.stringify({
op: 'unsubscribe',
args: ['order', 'wallet']
})
);
})

EVENTS​

The private events you can subscribe to are:

EventDescription
orderNotifications for newly created orders and order updates.
usertradeNotifications for user trades (recent trades snapshot and updates).
depositNotifications for deposits updates.
withdrawalNotifications for withdrawals updates.
stakeNotifications for stake updates (create/delete).
walletNotifications for balance updates.

Private Updates​

order


{
"topic": "order",
"action": "partial",
"user_id": 1,
"data": [
{
"id": "7d3d9545-b7e6-4e7f-84a0-a39efa4cb173",
"side": "buy",
"symbol": "btc-usdt",
"type": "limit",
"size": 0.1,
"filled": 0,
"price": 60000,
"stop": null,
"status": "new",
"fee": 0,
"fee_coin": "btc",
"meta": {},
"fee_structure": {
"maker": 0.1,
"taker": 0.1
},
"created_at": "2020-11-30T07:45:43.819Z",
"created_by": 1
},
...
],
"time": 1608022610
}

{
"topic": "order",
"action": "insert",
"user_id": 1,
"symbol": "btc-usdt",
"data": [
{
"id": "7d3d9545-b7e6-4e7f-84a0-a39efa4cb173",
"side": "buy",
"symbol": "btc-usdt",
"type": "limit",
"size": 0.1,
"filled": 0,
"price": 60000,
"stop": null,
"status": "new",
"fee": 0,
"fee_coin": "btc",
"meta": {},
"fee_structure": {
"maker": 0.1,
"taker": 0.1
},
"created_at": "2020-11-30T07:45:43.819Z",
"updated_at": "2020-12-15T08:56:45.066Z",
"created_by": 1
},
...
],
"time": 1608022610
}

{
"topic": "order",
"action": "update",
"user_id": 1,
"symbol": "btc-usdt",
"data": [
{
"id": "7d3d9545-b7e6-4e7f-84a0-a39efa4cb173",
"side": "buy",
"symbol": "btc-usdt",
"type": "limit",
"size": 0.1,
"filled": 0.1,
"price": 60000,
"stop": null,
"status": "filled",
"fee": 0,
"fee_coin": "btc",
"meta": {},
"fee_structure": {
"maker": 0.1,
"taker": 0.1
},
"created_at": "2020-11-30T07:45:43.819Z",
"updated_at": "2020-12-15T08:56:45.066Z",
"created_by": 1
},
...
],
"time": 1608022610
}

Order status and action​

The status of the order can be new, pfilled, filled, and canceled.

The action of the data determines what caused it to happen. All three are explained below:

ActionDescription
partialAll previous and current orders. Is the first order data received when connecting. Max: 50. Descending order.
insertWhen user's order is added. The status of the order can be either new, pfilled, or filled.
updateWhen user's order status is updated. Status can be pfilled, filled, and canceled.

usertrade


{
"topic": "usertrade",
"action": "partial",
"user_id": 2876,
"data": [
{
"side": "buy",
"symbol": "btc-usdt",
"size": 0.001,
"price": 60000,
"timestamp": "2026-01-19T02:54:35.636Z",
"order_id": "cc5ebec3-6e3f-4cb5-b5f9-49dd01843a08",
"fee": 0.0000005,
"fee_coin": "btc"
},
{
"side": "buy",
"symbol": "btc-usdt",
"size": 0.03074,
"price": 61200,
"timestamp": "2026-01-19T02:46:15.235Z",
"order_id": "0814a018-3e74-4330-9649-b06dc5107e27",
"fee": 0.00001537,
"fee_coin": "btc"
}
],
"time": 1768959647
}

{
"topic": "usertrade",
"action": "insert",
"user_id": 2876,
"symbol": "eth-usdt",
"data": [
{
"size": "0.001",
"side": "sell",
"price": 4000,
"symbol": "eth-usdt",
"timestamp": "2026-01-21T01:40:47.471Z",
"order_id": "1df5b4b4-3274-4183-8c52-282afb4dc1df",
"fee": "0.004",
"fee_coin": "usdt"
}
],
"time": 1768959647
}

stake


{
"topic": "stake",
"action": "insert",
"user_id": 2976,
"user_network_id": 15334,
"data": {
"reward": 0,
"slashed": 0,
"id": 28,
"user_id": 2976,
"stake_id": 7,
"amount": 0.5,
"nav": 0.5,
"currency": "eth",
"reward_currency": "eth",
"status": "staking",
"updated_at": "2026-01-21T01:26:31.449Z",
"created_at": "2026-01-21T01:26:31.449Z",
"closing": null,
"unstaked_date": null
},
"time": 1768958791
}

{
"topic": "stake",
"action": "delete",
"user_id": 2976,
"user_network_id": 15334,
"data": {
"id": 28,
"user_id": 2976,
"stake_id": 7,
"amount": 0.5,
"nav": 0.5,
"currency": "eth",
"reward_currency": "eth",
"reward": 0,
"slashed": 0,
"status": "unstaking",
"closing": null,
"unstaked_date": "2026-01-21T01:31:18.866Z",
"created_at": "2026-01-21T01:26:31.449Z",
"updated_at": "2026-01-21T01:31:18.867Z"
},
"time": 1768959078
}

deposit


{
"topic": "deposit",
"action": "insert",
"user_id": 1,
"data": {
"amount": 0.01,
"currency": "btc",
"status": "COMPLETED",
"transaction_id": "123",
...
},
"time": 1608021684
}

withdrawal


{
"topic": "withdrawal",
"action": "insert",
"user_id": 1,
"data": {
"amount": 0.01,
"currency": "btc",
"status": "COMPLETED",
"transaction_id": "123",
...
},
"time": 1608021684
}

wallet


{
"topic": "wallet",
"action": "partial",
"user_id": 1,
"data": {
"usdt_balance": 1,
"usdt_available": 1,
"btc_balance": 1,
"btc_available": 1,
"eth_balance": 1,
"eth_available": 1,
...,
"updated_at": "2020-12-15T08:41:24.048Z"
},
"time": 1608021684
}

Admin Events​

Admin websocket subscriptions can be used by exchange admins to receive deposit, withdrawal, and stake updates for all users automatically.

Connection


client.on('open', () => {
client.send(
JSON.stringify({
op: 'subscribe',
args: ['admin']
})
);
})

When subscribed to admin, the server will send deposit/withdrawal/stake messages in the same payload format as the private user events shown above, but covering all users.