How to request price value?

Hey there,
I’m working on a new thingy where I want to display the prices of certain crypto pairs to the user. My goal is to update the price every 3-5 seconds (didn’t decide on the interval yet) automatically, without the user needed to do anything. So simply put, I want to refresh the display price every few seconds.

I work in Angular and want to use the REST API. I read the documentation here: Get all known trading pairs

I would like to ask, how do I make the requests automatically without taking any action on the website? Should I use a setInterval and make the request after every 2-3 seconds or there is a better way? I think there is, I’m just not aware of it.

Is it this one? The ticker? If yes, how can I modify the request/second?

I think I should be able to modify the number of request and make the automatic but I don’t know how. Let me know if you can help.

Cheers,
Marco

Hi @marcopolocs, Welcome to Developers Forum. Thank you for taking an interest in trying out Coinbase APIs. For the details regarding your inquiry, we will check on this for you with our team to see how we can best assist. We’ll get back to you once we have more information. Keep in touch!

2 Likes

Hello @marcopolocs!

To achieve your goal which is to automate the price data of certain crypto pairs, you may try to use the websocket feature of Coinbase Pro. You may try to use the Ticker Batch channel since it provides the latest price updates every 5000 milliseconds (5 seconds) if there is a change. Unfortunately, the you cannot modify the request/second since the Ticker Batch has a fix updates every 5 seconds.

For more information about the Websocket, you may check our API documentation on this link: Channels

2 Likes