orderbookupdate pushes incremental updates, orderbook10 pushes a 10-level snapshot.
Pushing Rules
- No user login required
orderbookupdate: incremental updates, RPI orders are not included.orderbookupdaterpi: incremental updates including both non-RPI and RPI ordersorderbook10: a 10-level snapshot pushed every 200ms
Orderbook Update
Request
Request
orderbookupdate@<symbol>@<depth>
- symbol: Trading pair, such as
PERP_BTC_USDT - depth: Depth level, support
50,200or500
Response
Response
How to correctly maintain a copy of OrderBook locally:
- Subscribe to
orderbookupdate@<symbol>@<depth>and buffer the messages received - Request the snapshot via REST
GET /v3/public/orderbook?symbol=<symbol>&maxLevel=<depth> - Start processing the buffered messages whose
prevTsequals the timestamp of the snapshot - For each newly processed message, check that its
prevTsequals thetsof the previous message. If not, a message was missed, request the snapshot again and rebuild - If a price level has quantity
0, delete that price level - If a price level does not exist, insert it with the quantity
- If a price level already exists, update it with the new quantity
Orderbook 10
Request
Request
orderbook10@<symbol>
- symbol: Trading pair, such as
PERP_BTC_USDT
Response
Response
Each push is the full 10 levels.
Orderbook Update (RPI)
Subscribe to the delta updates of the order book with both non-RPI and RPI orders.Request
Request
orderbookupdaterpi@<symbol>@<depth>
- symbol: Trading pair, such as
PERP_BTC_USDT - depth: Depth level, support
50,200or500. The push interval is the same asorderbookupdate
Response
The response format is the same asorderbookupdate, with topic being orderbookupdaterpi@PERP_BTC_USDT@50.
How to correctly maintain a copy of OrderBook locally:
- Subscribe to
orderbookupdaterpi@<symbol>@<depth>and buffer the messages received - Request the snapshot via REST
GET /v3/public/orderbook?symbol=<symbol>&maxLevel=<depth>&rpi=true - Follow steps 3 to 7 of the
orderbookupdateprocedure above