Subscribing to Advanced Trade WebSocket channels

What is correct way to subscribe to channels?

Documentations shows two formats - "channel": [{ "name": "status"}] and "channel": ["ticker"]. But both are not accepted! I get following error:

json: cannot unmarshal array into Go struct field RawControlMessage.channel of type string

Subscribtion “succeeds” if I do "channel":"status" but there are no status messages… All I get after “subscribe” message is following message:

{“channel”:“subscriptions”,“client_id”:“”,“timestamp”:“2022-11-16T18:56:34.443664196Z”,“sequence_num”:0,“events”:[{“subscriptions”:{}}]}

Are there problems with websocket or documentation is missing some extra info? Documentation says that all messages have type attribute but clearly above message does not have such attribute.

1 Like

level2 and user channels returns:

channel x is not supported

1 Like

Hello @muktupavels! Welcome to the forum! 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!

2 Likes

Same issue here! I did just register an API key though (hasn’t been 48 hours yet) .

Hello @muktupavels and @han! We appreciate your patience with regards to both of your situations. We have received an update from our team that they made changes to the Advanced Trade API (Beta) documentation. They updated all channel field instances to a string and added subscription sample code. You may view the documentation for WS Channels and WebSocket Overview here. Additionally, fixes for channels user & level2 will be deployed to production soon. Thank you and keep in touch!

3 Likes

Any comment about status channel?

Also both ticker channels seems to be missing data compared to Coinbase Pro websocket.

Hi @muktupavels, the “status” channel should work as expected since all the channel scripts were changed/updated. Please let us know if you would be experiencing any errors/challenges. With regards to your concern about the “missing data” in both ticker channels, can you elaborate on what you mean by that? This will help us in better understanding your situation. Thank you!

1 Like

@Faker Any ETA for the fix to user and level2 channels?

Hi there @dpkw! As of the moment, the team is still hard at work on this and cannot give out an exact date. Do not worry though as we will give an update once this issue has been resolved. Thank you and keep in touch!

1 Like

I just posted a note about the missing data in the Feedback thread. It looks like data points like Best Bid, Best Ask, Last Size which are present in the Coinbase Pro websocket are not present in the Advanced Trade websocket. Appears there may be a few other fields as well.

1 Like

Hello @channa48. I appreciate your feedback and feature requests in the Advanced Trade Feedback thread. Coinbase is currently building REST and Websocket protocols on Advanced Trade so that customers can use Advanced Trade under one unified Coinbase account. However, the team is still hard at work on this and can’t offer any specific timeline for the features you’ve mentioned. For more updates regarding your queries, I suggest you regularly check the Advanced Trade Feedback thread. If you have any other feedback or requests, feel free to post them in the Feedback Section of the Developer Forum. Thank you!

In regards to the original post, I think it’s because you have the brackets. In JSON, ["string_inside_of_brackets"] still equates to an array, even if the only item in the array is a string.

On the Coinbase side, they are parsing the JSON data you send, and putting it into a Go struct which is expecting a string. ["ticker"] equates to an array, so it throws an error because it sees the wrong data type. Try just "channel": "ticker"

"channel":"status" should be correct. I believe that channel also needs a list of products that you want updates for. The docs say “all products” but I get the same mostly blank message you do if I don’t send an array of products as well. When I do send products, I get a status message for each product. Apparently this is sent at intervals but I don’t know what those intervals are. I’m assuming daily or something slow like that.

I already figured out that channel is just string and they have also updated documentation.

Status channel becomes somewhat useless to me if I have to specify products. I want to receive info about all products and all currencies as documentation says. I use status channel to know when new products are added, products have some changes or are removed. Same with currencies.

Also interval is not daily, at least not in Coinbase Pro. It is 5s if I remember correctly.

Fair enough. @Faker said it was fixed now, maybe it isn’t? I never used the Pro websocket and don’t see much use for the current status channel. The /products REST endpoint returns far more data about all products than the status channel. I would just call that every 5 seconds and parse for any with the “new: true” attribute. For now at least.

It must be broken. Other channels are fine, but it’s definitely been more than 5 seconds and I have only received the initial message.

user and level2 channels appear to be working now

1 Like

Hello there @muktupavels , @han, and @dpkw! Just an update, fix for channels user & level2 are deployed to production & doc - WS Channel is updated as well. Thank you @jmicko, for providing an update to the community as well, really appreciated it.

2 Likes

Documentation needs more fixes. side now seems to be “bid” or “offer” while documentation still mentions “buy” as example. Also data does not have have size property, it is now called new_quantity.

Hello @muktupavels! Thank you for flagging this mismatch between the Websocket Channel response data and the available Advanced Trade documentation. Related to this, we’d appreciate it if you could log this concern in the Feedback Section of the Developer Forum so the relevant Team could take a look at it, as most new improvements to Coinbase come directly from feedback like yours. Have a great day!

2 Likes

Hi there @muktupavels! The documentation has now been updated. The sample is now "side":"bid", side is either bid or ask . The size property is now replaced by new_quantity. Stay tuned for more updates ahead. Have a great day!

2 Likes