Speed of updates too slow

i’m calling /api/v3/brokerage/products/{product_id} to get the last price of BTC-USD for instance, but the issue it seems that the data is only updated once every 5 minutes. why is the update speed so slow?

Probably because they are pushing use of the websocket for anything where you need live data. It’s a lot better at handling that kind of stuff.

1 Like

i see, you are probably right. what i’m concerned about is all of this is in beta, i saw the websocket API documentation was only recently updated so not sure how stable it is. meanwhile coinbasepro is being actively sunsetted. just trying to do simple things like get latest price. i guess will need to check out the websocket API as that is the only viable way to get market data. a 5 minute delay is too long, a lot can happen in 5 minutes…

1 Like

Ha yeah, it’s been a bit difficult with the transition. There will be times where the websocket API or an endpoint goes down for like 10 minutes while they update something. On the upside, when it works it seems to work well and I like it better than the old Pro API (for my use case at least).

Are you by chance using JavaScript? If so I can share my code and save you some time fiddling with the websocket.

1 Like

This is disappointing. I am showing updates once per minute in my current testing. This is unacceptable for a financial product.

Coinbase, when can we expect updates to be faster?

1 Like

i see, thanks again, i will explore the websocket API, sounds like it’s the only way to get the data in reasonable time. my code is in java, but if you’d like to share your javascript websocket code it may be useful to get my version up and running faster, thank you!

actually don’t worry about it, i got the websockets working in java without many issues, it is indeed a much better way of getting the streaming data rapidly.

1 Like

I think the most important thing with the websocket is just figuring out a way to reset it if it malfunctions without warning. There are times where it will just stop getting updates after a while, but won’t close and won’t emit an error event so you can’t rely on those to reopen it. I used a timer function to close the socket after 10 seconds that resets every time I get a message. Sub to the ticker channel, and I get messages several times a second to reset that timer. Not sure how that would look in Java, but that was my strategy.

1 Like

in java, one way to get this working is to create a new class which extends the WebSocketClient class. inside this class, one can override the onClose() event handler method and perform the reconnect logic. seems to be stable so far and handles the reconnections.

2 Likes