WebSocket Market Data API
Basic Info
- The base URL for all WSS endpoints listed in this document is:
wss://nbstream.binance.com/w3w/wsa/stream
Subscribe / Unsubscribe Streams in Real Time
- You can subscribe to or unsubscribe from streams by sending messages over WebSocket. Examples are shown below.
- The
idin the request is used as a unique identifier to correlate request/response messages. The following formats are accepted:- 64-bit signed integer
- Alphanumeric string; max length 36
- null
- If
resultin the corresponding response isnull, it indicates the request was sent successfully.
Subscribe to a stream
Request
{
"method": "SUBSCRIBE",
"params": [
"came@allTokens@ticker24"
],
"id": 1
}
Response
{
"result": null,
"id": 1
}
Unsubscribe from a stream
Request
{
"method": "UNSUBSCRIBE",
"params": [
"came@allTokens@ticker24"
],
"id": 1
}
Response
{
"result": null,
"id": 1
}
List current subscriptions
Request
{
"method": "LIST_SUBSCRIPTION",
"id": 3
}
Response
{
"result": ["came@allTokens@ticker24"],
"id": 3
}
Streams
came@allTokens@ticker24
{
"data": {
"d": [
{
"ca": "0x8fce7206e3043dd360f115afa956ee31b90b787c@56", // Contract address@Chain ID
"cnt24": 10426, // Number of trades in the last 24h
"fdv": "72834145.18711072", // Fully Diluted Valuation (FDV)
"hc": "6822", // Number of holders
"liq": "1442996.98151177662835", // Liquidity
"mc": "13542034.24008014", // Market cap
"p": "0.072849536538593663", // Current price
"pc24": "-2.32", // 24h price change %
"s": "1",
"t": 1771825733000, // Timestamp (ms)
"vol24": "12930712.213702157742688594285" // 24h volume
}
],
"e": "tickerList"
},
"stream": "came@allTokens@ticker24"
}
<symbol>@aggTrade
{
"data": {
"E": 1771828569861, // Event time (ms)
"T": 1771828569702, // Trade time (ms)
"a": 2684294, // Aggregated trade ID
"e": "aggTrade", // Event type
"f": 2684294, // First trade ID in the aggregation
"l": 2684294, // Last trade ID in the aggregation
"m": false, // Is the buyer the market maker
"p": "0.08530000", // Price
"q": "879.24000000", // Quantity
"s": "ALPHA_474USDT" // Symbol
},
"stream": "alpha_474usdt@aggTrade"
}
<symbol>@fulldepth@<interval>
interval: 0ms, 100ms, 500ms
This stream returns all available depth, which includes UI and API orders.
{
"data": {
"E": 1771828614381, // Event time (ms)
"T": 1771828614258, // Matching time (ms)
"U": 42648947917, // First updateId in this event
"a": [
["0.07680652", "0.00000000"],
["0.08529794", "0.00000000"]
],
"b": [
["0.08513788", "0.00000000"],
["0.08520502", "23.47000000"],
["0.08521196", "320.94000000"],
["0.08529880", "0.00000000"],
["0.08529885", "0.00000000"]
],
"e": "depthUpdate",
"pu": 42648947321, // Previous updateId from the last push
"s": "ALPHA_474USDT",
"u": 42648948229 // Last updateId in this event
},
"stream": "alpha_474usdt@fulldepth@500ms"
}
came@contractAddress@chainId@kline_<interval>
interval: 1s, 1m, 5m, 15m, 1h, 4h, 1d
{
"data": {
"ca": "G7vQWurMkMMm2dU3iZpXYFTHT9Biio4F4gZCrwFpKNwG@CT_501", // Contract address@Chain ID
"e": "kline",
"k": {
"c": "0.15584957424118055058", // Close price
"ct": 1771828656000, // Kline close time
"h": "0.15584957424118055058", // High price
"i": "1s", // Interval
"l": "0.15584372258086979622", // Low price
"o": "0.15584372258086979622", // Open price
"ot": 1771828655000, // Kline open time
"v": "2.8584092999332775480" // Volume
}
},
"stream": "came@G7vQWurMkMMm2dU3iZpXYFTHT9Biio4F4gZCrwFpKNwG@CT_501@kline_1s"
}
<symbol>@bookTicker
{
"data": {
"A": "2.00353200", // ask1Quantity
"B": "0.91076900", // bid1Quantity
"E": 1773108379067, // eventTime
"T": 1773108379054, // transactionTime
"a": "9.30000000", // ask1Price
"b": "8.30000000", // bid1Price
"e": "bookTicker", // eventType
"s": "ALPHA_116USDT", // symbol
"u": 6663207693 // updateId
},
"stream": "alpha_116usdt@bookTicker"
}
!bookTicker
{
"data": {
"A": "2.00353200", // ask1Quantity
"B": "0.91076900", // bid1Quantity
"E": 1773108379067, // eventTime
"T": 1773108379054, // transactionTime
"a": "9.30000000", // ask1Price
"b": "8.30000000", // bid1Price
"e": "bookTicker", // eventType
"s": "ALPHA_116USDT", // symbol
"u": 6663207693 // updateId
},
"stream": "!bookTicker"
}
<symbol>@miniTicker
{
"data": {
"E": 1773109449908, // eventTime
"c": "8.40000000", // closePrice
"e": "24hrMiniTicker", // eventType
"h": "8.50000000", // highPrice
"l": "8.30000000", // lowPrice
"o": "8.40000000", // openPrice
"q": "543810.36005090", // quoteVolume
"s": "ALPHA_116USDT", // symbol
"v": "64739.03978900" // volume
},
"stream": "alpha_116usdt@miniTicker"
}
!miniTicker@arr
{
"data": {
"E": 1773109449908, // eventTime
"c": "8.40000000", // closePrice
"e": "24hrMiniTicker", // eventType
"h": "8.50000000", // highPrice
"l": "8.30000000", // lowPrice
"o": "8.40000000", // openPrice
"q": "543810.36005090", // quoteVolume
"s": "ALPHA_116USDT", // symbol
"v": "64739.03978900" // volume
},
"stream": "!miniTicker@arr"
}
<symbol>@ticker
{
"data": {
"C": 1773109631555, // endTime
"E": 1773109631569, // eventTime
"F": 19847634, // firstTradeId
"L": 19911287, // lastTradeId
"O": 1773023220000, // startTime
"P": "0.00", // priceChangePercent
"Q": "0.49293200", // lastTradeVolume
"c": "8.40000000", // closePrice
"e": "24hrTicker", // eventType
"h": "8.50000000", // highPrice
"l": "8.30000000", // lowPrice
"n": 217505, // tradeNum
"o": "8.40000000", // openPrice
"p": "0.00000000", // priceChange
"q": "543907.35169250", // quoteVolume
"s": "ALPHA_116USDT", // symbol
"v": "64750.63418500", // volume
"w": "8.40003127" // averagePrice
},
"stream": "alpha_116usdt@ticker"
}
!ticker@arr
{
"data": {
"C": 1773109631555, // endTime
"E": 1773109631569, // eventTime
"F": 19847634, // firstTradeId
"L": 19911287, // lastTradeId
"O": 1773023220000, // startTime
"P": "0.00", // priceChangePercent
"Q": "0.49293200", // lastTradeVolume
"c": "8.40000000", // closePrice
"e": "24hrTicker", // eventType
"h": "8.50000000", // highPrice
"l": "8.30000000", // lowPrice
"n": 217505, // tradeNum
"o": "8.40000000", // openPrice
"p": "0.00000000", // priceChange
"q": "543907.35169250", // quoteVolume
"s": "ALPHA_116USDT", // symbol
"v": "64750.63418500", // volume
"w": "8.40003127" // averagePrice
},
"stream": "!ticker@arr"
}
<symbol>@trade
{
"data": {
"E": 1773110023891, // eventTime
"T": 1773110023877, // tradeTime
"e": "trade", // eventType
"m": false, // isBuyerMaker
"p": "8.40000000", // fillPrice
"q": "0.97915700", // fillQty
"s": "ALPHA_116USDT", // symbol
"t": 19911650 // tradeId
},
"stream": "alpha_116usdt@trade"
}
<symbol>@depth<levels>@<interval>
levels: optional, available values: [5, 10, 20]
interval: optional, available values: [0ms, 100ms, 500ms]
Please note that only UI orders will be shown.
{
"data": {
"E": 1773110222878, // eventTime
"T": 1773110222767, // transactionTime
"U": 6663367135, // firstUpdateId
"a": [
[
"8.30000000", // price
"8.02776700" // qty
]
],
"b": [
[
"8.40000000", // price
"1266.84789600" // qty
]
],
"e": "depthUpdate", // eventType
"pu": 6663366971, // previousUpdateId
"s": "ALPHA_116USDT", // symbol
"u": 6663367147 // lastUpdateId
},
"stream": "alpha_116usdt@depth"
}
<symbol>@kline_<interval>
available values: [1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M]
{
"data": {
"E": 1773111055144, // eventTime
"e": "kline", // eventType
"k": {
"B": "0", // ignore
"L": 19912765, // lastTradeId
"Q": "534.64960920", // takerBuyQuoteAssetVolume
"T": 1773111059999, // endTime
"V": "63.64876300", // takerBuyBaseAssetVolume
"c": "8.40000000", // closePrice
"f": 19912696, // firstTradeId
"h": "8.40000000", // highPrice
"i": "1m", // interval
"l": "8.40000000", // lowPrice
"n": 218, // tradeNum
"o": "8.40000000", // openPrice
"q": "534.64960920", // quoteAssetVolume
"s": "ALPHA_116USDT", // symbol
"t": 1773111000000, // startTime
"v": "63.64876300", // volume
"x": false // klineComplete
},
"s": "ALPHA_116USDT" // symbol
},
"stream": "alpha_116usdt@kline_1m"
}
How to maintain a local order book copy
The <symbol>@fulldepth@<interval> stream and the [Full Depth] snapshot share the same update ID space (U / u / pu / lastUpdateId), so a local order book copy can be built and maintained as follows:
- Open a stream to
wss://nbstream.binance.com/w3w/wsa/streamand subscribe to<symbol>@fulldepth@<interval>(e.g.alpha_111usdt@fulldepth@100ms) by sending:{"method":"SUBSCRIBE","params":["alpha_111usdt@fulldepth@100ms"],"id":1} - Buffer the events you receive from the stream. For the same price, the latest received update covers the previous one.
- Get a depth snapshot from
GET https://www.binance.com/bapi/defi/v1/public/alpha-trade/fullDepth?symbol=ALPHA_111USDT&limit=1000(public endpoint, no authentication required; validlimitvalues: 5, 10, 20, 50, 100, 500, 1000, default 500). - Drop any event where
uis <lastUpdateIdin the snapshot. - The first processed event should have
pu<=lastUpdateIdANDu>=lastUpdateId. Note thatlastUpdateIdfrequently falls betweenpuandUof that event — this is normal (see the notes below); do NOT requireU<=lastUpdateId. - While listening to the stream, each new event's
pushould be equal to the previous event'su, otherwise re-initialize the process from step 3. - The data in each event is the ABSOLUTE quantity for a price level.
- If the quantity is 0, REMOVE the price level.
- Receiving an event that removes a price level that is not in your local order book can happen and is normal.
Note — Differences from Spot/Futures depth streams:
- U is not gap-free. Between consecutive events,
Uis generally greater than the previous event'su+ 1 (gaps ranging from tens to thousands of update IDs are routinely observed). TheU == previous u + 1continuity check used for Spot/Futures depth streams does NOT apply to Alpha. Usepu(step 6) as the only continuity anchor. - Do not mix depth views.
@fulldepth@<interval>events and thefullDepthsnapshot include both UI and API orders, while the<symbol>@depth<levels>@<interval>stream includes UI orders only. Building a book from the@depthstream on top of afullDepthsnapshot produces inconsistent results. - Include the interval suffix. The documented stream name is
<symbol>@fulldepth@<interval>(0ms, 100ms, 500ms). - Quiet periods. For low-activity symbols the order book may stay unchanged for many seconds: the snapshot
lastUpdateIdstops advancing and no events are pushed. Do not treat the absence of events alone as a disconnection — rely on thepucheck on the next received event plus standard WebSocket ping/pong.