The fastest way to get new rates is to subscribe to our WebSockets. With our WebSockets you can establish a persistent connection through which new rates are pushed, so you do not have to poll for new data points.
The WebSocket protocol does not support regular HTTP headers, so it is not possible to use the x-access-token header when opening a new WebSocket. Authenticate to our WebSockets connections using a query parameter:
wss://api.coinranking.com/v2/real-time/rates?x-access-token=your-api-key
Establish a WebSocket connection to get rates in real-time. There are two ways to subscribe to coins; directly establish a connection with subscriptions by using query parameters to select your subscriptions, or establish a connection and send a JSON message through the socket with the subscriptions you require.
wss://api.coinranking.com/v2/real-time/rates
Parameter | Description |
---|---|
uuids Array |
With the UUIDs parameter, you can select which coins to subscribe to. Provide a list of coin UUIDs to make your selection, use our other endpoints or our website to find the UUIDs of coins you want. There is a maximum of hundred UUIDs you can subscribe to within one WebSocket. Size range: 1-100Example:
...real-time/rates?uuids[]=Qwsogvtv82FCd&uuids[]=razxDUgYGNAdQ
|
throttle (optional) String |
With the throttle parameter, you prevent getting overloaded with rates. This is useful if performance is an issue, e.g. when using WebSockets in your frontend and want to prevent straining your client's their devices too much. Throttling works per coin. If you select a throttle, this means rates for the same coin will not be pushed more than once within the specified duration. When you have subscribed to multiple coins, you still receive more messages within the specified duration. You can choose between 1s (At least one second interval between a rate for each coin) or 10s (ten seconds). Default value: 1sAllowed values: 1s 10s Example:
...real-time/rates?throttle=10s
|
list (optional) String |
With the list parameter, you can subscribe to a list of coins. The default is to subscribe to none and filter on UUIDs. Besides the none option, you can also choose all to subscribe to every rate. You can choose between none (no list is selected and you can use the UUIDs parameter to filter the list) or all (every rate). Default value: noneAllowed values: none all Example:
...real-time/rates?list=all
|
json{
"currencyUuid": "Qwsogvtv82FCd",
"price": "59585.64479860372914892766",
"volume": "33769051110.0956537043822976375655904"
}
Property | Description |
---|---|
currencyUuid String | The currency of this rate |
price String | The latest price of this coin |
volume String | The latest volume of this coin |