Description
Rate Limit: 10 requests per second per IP for Subscribe and Unsubscribe.
Upon subscription, the first push will include the full quantity of bids | asks; subsequent pushes will only include increments.
Response Packet Protocol: binary
Request
{
"event": "SUBSCRIBE",
"arg": [
{
"channel": "ORDER_BOOK",
"instId": "OKX_PERP_BTC_USDT"
},
{
"channel":"ORDER_BOOK",
"instId":"BINANCE_SPOT_BTC_USDT"
},
{
"channel":"ORDER_BOOK",
"instId":"OKX_SPOT_BTC_USDT"
},{
"channel":"ORDER_BOOK",
"instId":"BINANCE_PERP_BTC_USDT"
}
]
}
Field name | Type | Necessary | Remarks |
---|---|---|---|
event | String | Y | SUBSCRIBE, UNSUBSCRIBE |
args | Array | Y | Subscribe param. There can be no more than 50 instId parameters per subscribe. |
> channel | String | Y | Channel name |
> instId | String | Y | Unique identifier |
Response
{
"event": "SUBSCRIBE",
"arg": [
{
"channel": "ORDER_BOOK",
"instId": "OKX_PERP_BTC_USDT"
},
{
"channel": "ORDER_BOOK",
"instId": "BINANCE_SPOT_BTC_USDT"
},
{
"channel": "ORDER_BOOK",
"instId": "OKX_SPOT_BTC_USDT"
},
{
"channel": "ORDER_BOOK",
"instId": "BINANCE_PERP_BTC_USDT"
}
],
"code": 0,
"message": "Success"
}
Field | Type | Remarks |
---|---|---|
event | String | SUBSCRIBE, UNSUBSCRIBE |
code | String | Error Code |
msg | String | Error Message |
args | Array | Subscribe param |
> channel | String | Channel |
> instId | String | Unique identifier |
Order book example:
{
"arg": {
"channel": "ORDER_BOOK",
"instId": "BINANCE_PERP_BTC_USDT"
},
"data": {
"localTs": 1736426510957751300,
"exchangeTs": 1736426510956000000,
"seqNum": 5818843132,
"type": "update",
"preseqNum": 5818843129,
"ltp": "93261.400000",
"ttv": "167880070889.075409",
"ttq": "1742014.077255",
"state": "0",
"bids": [
[
"93252.900000",
"0.000000"
],
[
"93253.000000",
"4.086000"
],
[
"93254.200000",
"0.003000"
],
[
"93256.300000",
"0.055000"
],
[
"93261.300000",
"7.568000"
]
],
"asks": [
[
"93261.400000",
"1.434000"
],
[
"93271.700000",
"0.008000"
]
],
"trades": [
[
"93261.400000",
"0.012000",
"1",
"1736426510914000000"
],
[
"93261.400000",
"0.009000",
"1",
"1736426510956000000"
]
]
}
}
Field | Type | Remarks |
---|---|---|
channel | String | example: ORDER_BOOK |
instId | String | Unique identifier |
exchangeTs | Long | Exchange timestamp |
localTs | Long | Local timestamp |
type | String | "Update" for Incremental Data, "All" for Full Data. |
preseqNum | Long | Last Sequence Number |
seqNum | Long | Current Sequence Number |
ltp | String | Last traded price |
ttv | String | Latest traded volume |
ttq | String | Latest traded quantity |
state | String | Trading Pairs state(NORMAL=0,CLOSE=1) |
bids | Array | Bid levels, up to 50 levels |
> price | String | Price |
> qty | String | Quantity |
asks | Array | Ask levels, up to 50 levels |
> price | String | Price |
> qty | String | Quantity |
trades | Array | transactions |
> price | String | Price |
> qty | String | Quantity |
> side | String | Side(BUY=0,SELL=1) |
> exchangeTs | Long | Transaction Time |