CEX order book market update

Viewed 501

I am trying to use cex.io API to construct a live order book, but I am struggling understanding the message from the API.

I am subscribing with the following JSON:

{
  "e":    "order-book-subscribe",
  "data": {
            "pair":      [
                          "BTC",
                          "USD"
                          ],
            "subscribe": false,
            "depth":    -1
            },
  "oid": "1435927928274_3_order-book-subscribe"
  }

The first message is a snapshot of the order book, this one its ok.

But next, the messages are "just" updates, same as this one :

{ 
  'e':    'md_update',
  'data': { 
           'id':    92276361,
           'pair': 'BTC:USD',
           'time':  1505337293621,
           'bids':  [],
           'asks':  [
                      [4078.1692, 0.0]
                      ]
           }
  }

How do I update the snapshot first received with the updates lines ?

How do I know, if some of the lines if there was match in the book ?

And also if I subscribe with depth = 1, would the updates only be for best bid / best ask ?

1 Answers
Related