Channels
WebSocket channel message formats
ticker
Real-time price updates for a symbol.
{
"channel": "ticker",
"symbol": "BTCUSDT",
"data": {
"symbol": "BTCUSDT",
"lastPrice": "71034.5",
"priceChange": "1052.3",
"priceChangePercent": "1.503",
"highPrice": "71500.0",
"lowPrice": "69200.0",
"volume": "12543.231",
"quoteVolume": "891234567.89"
},
"ts": 1711756800000
}orderbook
Order book depth updates (top 50 levels, throttled to ~200ms).
{
"channel": "orderbook",
"symbol": "BTCUSDT",
"data": {
"lastUpdateId": 123456,
"bids": [["71034.5", "1.234"], ["71034.0", "0.567"]],
"asks": [["71035.0", "2.345"], ["71035.5", "0.890"]]
},
"ts": 1711756800000
}Each entry is [price, quantity].
trades
Recent trades stream.
{
"channel": "trades",
"symbol": "BTCUSDT",
"data": [
{
"id": 123456,
"price": "71034.5",
"qty": "0.123",
"time": 1711756800000,
"isBuyerMaker": false
}
],
"ts": 1711756800000
}kline
Candlestick data updates (polled every 5s).
{
"channel": "kline",
"symbol": "BTCUSDT",
"data": [
[1711756800000, "71000.0", "71500.0", "70800.0", "71034.5", "1234.567", 1711756859999, "87654321.0", 523, "617.283", "43827160.5", "0"]
],
"ts": 1711756800000
}Format: [openTime, open, high, low, close, volume, closeTime, quoteVol, trades, takerBuyBaseVol, takerBuyQuoteVol, ignore]
markprice
Real-time mark price, index price, and funding rate updates (~1 second intervals).
{
"channel": "markprice",
"symbol": "BTCUSDT",
"data": {
"symbol": "BTCUSDT",
"markPrice": "71045.20",
"indexPrice": "71042.80",
"fundingRate": "0.00010",
"nextFundingTime": 1711760400000
},
"ts": 1711756800000
}| Field | Description |
|---|---|
markPrice | Current mark price used for PnL and liquidation |
indexPrice | Underlying index price |
fundingRate | Current funding rate |
nextFundingTime | Next funding settlement timestamp (Unix ms) |
account (Authenticated)
Requires authentication. Account state is pushed in real-time when changes occur (event-driven), with a periodic fallback every ~60 seconds.
Full State Update
Pushed immediately after authentication, and whenever positions, orders, or balances change.
{
"channel": "account",
"data": {
"balances": [
{
"asset": "USDT",
"walletBalance": "1250.50",
"unrealizedProfit": "26.75",
"marginBalance": "1277.25",
"availableBalance": "980.30"
}
],
"openOrders": [
{
"orderId": 12345,
"symbol": "BTCUSDT",
"status": "NEW",
"price": "70000",
"origQty": "0.01",
"executedQty": "0",
"type": "LIMIT",
"side": "BUY",
"positionSide": "LONG",
"time": 1711756800000
}
],
"positions": [
{
"symbol": "BTCUSDT",
"quantity": "0.05",
"avgEntryPrice": "70500.00",
"markPrice": "71034.50",
"liquidationPrice": "51493.41",
"unrealizedPnl": "26.75",
"realizedPnl": "0",
"fundingFee": "-1.23",
"initialMargin": "176.25",
"leverage": 20,
"marginMode": "Isolated"
}
]
},
"ts": 1711756800000
}| Position Field | Type | Description |
|---|---|---|
quantity | string | Position size. Positive = long, negative = short |
avgEntryPrice | string | Average entry price |
markPrice | string | Current mark price from exchange |
liquidationPrice | string | Estimated liquidation price |
unrealizedPnl | string | Unrealized PnL |
realizedPnl | string | Realized PnL |
fundingFee | string | Accumulated funding fees |
initialMargin | string | Initial margin (collateral) |
leverage | number | Position leverage multiplier |
marginMode | string | Isolated or Cross |
Order Events
Pushed immediately when orders are created, updated, or cancelled:
{
"channel": "account",
"event": "order_new",
"data": {
"order": { "orderId": 12345, "symbol": "BTCUSDT", "status": "NEW" }
},
"ts": 1711756800000
}{
"channel": "account",
"event": "order_canceled",
"data": {
"order": { "orderId": 12345, "symbol": "BTCUSDT", "status": "CANCELED" }
},
"ts": 1711756800000
}{
"channel": "account",
"event": "order_update",
"data": {
"orderId": "clx...",
"symbol": "BTCUSDT",
"oldStatus": "NEW",
"newStatus": "FILLED"
},
"ts": 1711756800000
}Position Events
Pushed when positions change (open, close, size change, PnL recalculation, margin adjustment):
{
"channel": "account",
"event": "position_update",
"data": {
"symbol": "BTCUSDT",
"positionId": "33600",
"quantity": "0.05",
"avgEntryPrice": "70500.00",
"markPrice": "71034.50",
"liquidationPrice": "51493.41",
"unrealizedPnl": "26.75",
"realizedPnl": "0",
"fundingFee": "-1.23",
"initialMargin": "176.25",
"maintenanceMargin": "14.10",
"marginBalance": "202.75",
"leverage": 20,
"marginMode": "Isolated",
"adl": 2,
"openedAt": "2026-04-02T22:29:35.065Z"
},
"ts": 1711756800000
}| Field | Type | Description |
|---|---|---|
positionId | string | Exchange-assigned position ID |
quantity | string | Position size. Positive = long, negative = short |
avgEntryPrice | string | Average entry price |
markPrice | string | Current mark price |
liquidationPrice | string | Estimated liquidation price |
unrealizedPnl | string | Unrealized PnL |
realizedPnl | string | Realized PnL |
fundingFee | string | Accumulated funding fees |
initialMargin | string | Initial margin (collateral) |
maintenanceMargin | string | Maintenance margin requirement |
marginBalance | string | Current margin balance |
leverage | number | Leverage multiplier |
marginMode | string | Isolated or Cross |
adl | number | Auto-deleverage indicator (0-5) |
openedAt | string | Position open timestamp |
Position closed (quantity = "0"):
{
"channel": "account",
"event": "position_update",
"data": {
"symbol": "BTCUSDT",
"positionId": "33600",
"quantity": "0",
"closed": true
},
"ts": 1711756800000
}Balance Events
{
"channel": "account",
"event": "balance_update",
"data": {
"type": "Futures",
"symbol": "USDT",
"free": "980.30",
"locked": "270.20",
"total": "1250.50"
},
"ts": 1711756800000
}Futures Account Update
Pushed when account-level margin or equity changes:
{
"channel": "account",
"event": "futures_account_update",
"data": {
"symbol": "BTCUSDT",
"availableBalance": 15000.00,
"maintenanceMargin": 163.08,
"marginBalance": 3350.00,
"balance": 18350.00,
"accountEquity": 18475.75,
"unrealizedPnL": 125.75,
"walletMode": "OneWay",
"marginCallRate": 20,
"marginRatio": 0.048
},
"ts": 1711756800000
}Other Events
| Event | Description |
|---|---|
notification | System alerts and announcements |
deposit_update | Crypto deposit status change |
withdraw_update | Withdrawal status change |
transfer_update | Internal transfer status change |
