Orderbook update
Topic: orderbookupdate@{symbol}
@{depth}
Subscribe to order book delta updates with different number of levels.
-
With depth level of 50, the incremental changes pushed every 50ms
-
With depth level of 200, the incremental changes pushed every 100ms
-
With depth level of 500, the incremental changes pushed every 200ms
To keep a local copy of the order book, please follow the steps below:
-
Open a market data stream and subscribe to orderbookupdate@
{symbol}
@{depth}
-
Buffer the updates you receive from the stream
-
Get an order book snapshot from https://api.woox.io/v3/public/orderbook?symbol={symbol}&maxLevel={depth}.
-
Start processing any updates where prevTs = timestamp in the snapshot
-
Check prevTs of each newly processed update is the same as the ts of the previous update
-
If you receive a price level with 0 size, delete that price level
-
If you receive a price level that does not exist, insert that price level and size
-
If you receive a price level that already exists, update that price level with the new size