Level2 channel and heartbeat

Hi, i am getting level2 data from coinbase api and i wonder how do i ensure the completeness of the data i receive. I noticed that the heartbeat i can subscribe but the sequences number seems to be always unmatched to the number of changes every interval of heartbeat.

Much appreciate for any help.

Hello @khorwei. Welcome to the forum! Thank you for taking an interest in trying out Coinbase APIs. For the details regarding your concern, we will check on this for you with our team. We will get back to you once we have more information. Keep in touch!

3 Likes

Hi @khorwei! For us to investigate further, can you tell us if you are using Level2 channel or Heartbeat channel?

Thanks!

3 Likes

Hi,

i am subscribing both together. As suggested in doc, subscribe heartbeat to get sequence number to check the completeness. One i get first sequence number from heartbeat, then, i add one to the sequence number after i get an new message from coinbase websocket. By do so, i have no luck to match the next sequence number i receive

Hello @khorwei ! Thank you for your patience and taking interest in using Coinbase Cloud. You may refer to this thread for your concern as you have similar queries.

It is also important to take note that sequence numbers may be greater or lesser than one integer value from the previous number as it may indicate that a message has been either dropped or arrived out of order. For more information, please visit the Websocket Overview documentation.

We hope this helps. Thank you!

1 Like

HI, thanks for the info. Here is my few cents, i read the thread before, but the point of getting level2 channel is to ease the data volume for both party. If all of us go to full channel because of data validation issue, then level2 provide no usefulness…

Hello @khorwei!

Our docs site states that we “guarantee” delivery in L2 channel:

“Subscribe to the level2 channel to guarantee that messages are delivered and your order book is in sync.”

You should only need to subscribe to the L2 channel to ensure order book completeness. However if you want to also do additional validation on your side, you can also use the Full channel to compare sequence numbers and last trade IDs with the Heartbeat channel.

Thanks!

4 Likes