API Reference

OrderBook

Subscribe

Rate Limit: 1 requests per 1 seconds per IP

Request

{  
    "action":"SUBSCRIBE",  
    "args":[  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"BINANCE_SPOT_BTC_USDT"  
        },  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"OKX_SPOT_BTC_USDT"  
        },{  
            "channel":"ORDER_BOOK",  
            "instId":"BINANCE_PERP_BTC_USDT"  
        },  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"OKX_PERP_BTC_USDT"  
        }
    ]  
}
 
Field nameTypeNecessaryRemarks
actionStringYAction
argsArrayYSubscribe param,there can be no more than 20 instId parameters per subscribe
> channelStringYChannel name
> instIdStringYUnique identifier

Response

{  
    "event": "SUBSCRIBE",  
    "args": [  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"BINANCE_SPOT_BTC_USDT"  
        },  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"OKEX_SPOT_BTC_USDT"  
        },{  
            "channel":"ORDER_BOOK",  
            "instId":"BINANCE_PERP_BTC_USDT"  
        },  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"OKX_PERP_BTC_USDT"  
        }   
    ],  
    "code": 0  
}
 
FieldTypeRemarks
eventStringEvent
codeStringCode
argsArrayData
> channelStringChannel
> instIdStringUnique identifier

Order book example:

{
    "instId": "BINANCE_SPOT_BNB_USDT",
    "publicChannelTypeEnum": "ORDER_BOOK",
    "exchangeTs": 1701048908942000000,
    "localTs": 1701048908944715333,
    "seqNum": 685893995,
    "ltp": 231.7,
    "ttv": 5.77130203645613E9,
    "ttq": 2.3642697332062364E7,
    "symbol": "BNBUSDT",
    "bookId": 0,
    "exchange": "BINANCE_SPOT",
    "tradingState": "NORMAL",
    "levelsBids": [
        {
            "price": 231.6,
            "qty": 282.5720000000001
        },
        {
            "price": 231.5,
            "qty": 701.415
        },
        {
            "price": 231.4,
            "qty": 688.059
        }
    ],
    "levelsAsks": [
        {
            "price": 231.7,
            "qty": 407.454
        },
        {
            "price": 231.8,
            "qty": 479.671
        },
        {
            "price": 231.9,
            "qty": 554.856
        },
        {
            "price": 232.0,
            "qty": 464.976
        }
    ],
    "updates": [
        {
            "price": 231.7,
            "qty": 0.258,
            "side": "SELL",
            "type": "TRADE",
            "level": 0
        }
    ]
}
FieldTypeRemarks
instIdStringUnique identifier
publicChannelTypeEnumStringPublicChannelType, example: ORDER_BOOK
exchangeTsLongExchange timestamp
localTsLongLocal timestamp
seqNumLongMessage sequence number
ltpDoubleLast traded price
ttvDoubleLatest traded volume
ttqDoubleLatest traded quote
symbolStringTrading symbol , example: BTCUSDT
bookIdIntegerBook ID
exchangeStringExchange
tradingStateStringTrading state(NORMAL,CLOSE)
levelsBidsArrayBid levels, up to 50 levels
> priceDoublePrice
> qtyDoubleQuantity
levelsAsksArrayAsk levels, up to 50 levels
> priceDoublePrice
> qtyDoubleQuantity
updatesArrayUpdates, up to 50 items
> priceDoublePrice
> qtyDoubleQuantity
> sideStringSide(BUY,SELL)
> typeStringUpdate type(ADD,DELETE,MODIFY)
> levelIntegerLevel of the order book

Unsubscribe

Rate Limit: 1 requests per 1 seconds per IP

Request

{  
    "action":"UNSUBSCRIBE",  
    "args":[  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"BINANCE_SPOT_BTC_USDT"  
        },  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"OKX_SPOT_BTC_USDT"  
        },{  
            "channel":"ORDER_BOOK",  
            "instId":"BINANCE_PERP_BTC_USDT"  
        },  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"OKX_PERP_BTC_USDT"  
        }   
    ]  
}
 
Field nameTypeNecessaryRemarks
actionStringYAction
argsArrayYData
> channelStringYChannel name
> instIdStringYUnique identifier

Response


 {  
    "event": "UNSUBSCRIBE",  
    "args": [  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"BINANCE_SPOT_BTC_USDT"  
        },  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"OKX_SPOT_BTC_USDT"  
        },{  
            "channel":"ORDER_BOOK",  
            "instId":"BINANCE_PERP_BTC_USDT"  
        },  
        {  
            "channel":"ORDER_BOOK",  
            "instId":"OKX_PERP_BTC_USDT"  
        }   
    ],  
    "code": 0  
}
FieldTypeRemarks
eventStringEvent
codeStringCode
argsArrayData
> channelStringChannel name
> instIdStringUnique identifier