I found a Websockets bug!

I subscribe to a “level2” channel for ADA-GBP.

This is what the message comes back as:

Look at the message “timestamp” and the event’s “event_time”. Something looks seriously wrong there. All the event_time fields are “1970-01-01T00:00:00Z”.

This response is also overly complex. Not sure why it was done like this. Just copy what was in Coinbase Pro or any other exchange for that matter.

1 Like

Is there a channel that will stream a ticker only? My code constructs candles on the fly but all I need is the timestamp, market and price. It looks like what is coming through now are the orders.

This is what I have now…

    channel = "level2"

    self.ws = create_connection(self._ws_url)
    self.ws.send(
        json.dumps(
            {
                "type": "subscribe",
                "product_ids": product_ids,
                "channel": channel,
                "api_key": self.app.api_key,
                "timestamp": timestamp,
                "signature": signature,
            }
        )
    )

It is already known - Level2 websocket channel too verbose!?.

For candles you might want ticker and/or market_trades channels.

Ok, thanks. I’ll try that.

I’ve got a logical hankering and question: Knowing that the websockets from Coinbase pro will have to stay active forever as part of the Exchange API offered to institutional / business clients makes me wonder why we will ever need to use the Advanced Trade websocket, since issuing commands to advanced trade does not require the new websocket integration. What I’m suggesting is that all interested parties (who are not trying to build an advanced trade orderbook) continue to use the old websocket even when submitting orders with the new api. Although coinbase pro is being sunsetted, the exchange API and websockets will need to remain for the institutional APIs. The pro API is actually being updated more frequently than the new one. Since the pro websockets are truly public endpoints, you can always connect to them without authentication from any machine in the world. This means there is no reason to mess with the new websockets at all until they are functioning properly, especially for simple ticker price data.

I’ve decided to use websockets from Coinbase Pro and market data from Coinbase in my app. The websocket data in Coinbase doesn’t look right to be and not easy to work with. I mean just one basic example is the data timestamps include nanoseconds. I don’t know why they did this as Python doesn’t handle it. I had to use Pandas to deal with the dates.

I have caught this bug too
You can find it in
channel: level_2
events.type: snapshot

{
  "channel": "l2_data",
  "client_id": "",
  "timestamp": "2023-12-26T16:38:58.707454376Z",
  "sequence_num": 595,
  "events": [
    {
      "type": "snapshot",
      "product_id": "DOGE-USD",
      "updates": [
        {
          "side": "bid",
          "event_time": "1970-01-01T00:00:00Z",
          "price_level": "0.09226",
          "new_quantity": "48588.2"
        },
        {
          "side": "offer",
          "event_time": "1970-01-01T00:00:00Z",
          "price_level": "0.09227",
          "new_quantity": "9940"
        }
      ]
    }
  ]
}