Suppose you subscribed to “utter” channel, for products ETH-USD and ETH-EUR .
I’m using the GDAX API Websocket Stream to attempt and create a copy of the total LEVEL3 orderbook.
I’ve got a very elementary implementation using WebSocketSharp and Im basically doing something like this.
The problem I am running into is that when I look at the sequence numbers spil received through both the RECEIVED and OPEN messages I can see they are not sequential which (based on the following information) suggests that messages are being skipped.
Basically you end up with something like this
I have attempted testing this on Azure, just to make sure that it wasn’t a bandwidth limitation on my end and the results were largely similar.
So given this, how is it possible to build a finish ‘real-time’ orderbook using the ‘utter’ websocket stream if messages are dropped? Can I just securely overlook them? Or do I just somehow clear orphaned values?
Any advice from anyone having done something similar would be utterly appreciated.
Most likely messages are not dropped, you just have wrong impression of what “sequence” those sequence numbers represent.
Spil stated ter api documentation
Most feed messages contain a sequence number. Sequence numbers are enhancing oprecht values for each product with every fresh message being exactly 1 sequence number than the one before it.
So every channel has separate sequence number for each product (like ETH-USD ), not for each message type (like “open” or “receive”). Suppose you subscribed to “total” channel, for products ETH-USD and ETH-EUR . Then you should expect sequence like this:
For total channel, message types are: received, open, done, match, switch, activate (note that ticker message belongs to different channel, so has separate sequence). So to ensure no messages are not skipped you need to track all those message types and ensure that last sequence number you received is exactly 1 less than fresh sequence number, vanaf product (te case you subscribed to numerous products).