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
You can generate a free API key. However, for our WebSockets you will need a pro subscription.
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.
GET /real-time/rates
https://api.coinranking.com/v2/real-time/rates
Name | Type | Description |
---|---|---|
uuids | Array | With the UUIDs parameter, you can select which coins to subscribe to. The UUIDs parameter is partly optional; you can choose to either subscribe to one or more coins, or you can subscribe to a list. Or both! But you have to at least select one list or one coin. 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 coins you can subscribe to within one websocket. Size range: 1-100 |
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), 10s (fifteen seconds), or none (in which case you get every rate for all the coins that you subscribed to). Default value: noneAllowed values: none 1s 10s |
{
"currencyUuid": "Qwsogvtv82FCd",
"price": "59585.64479860372914892766",
"volume": "33769051110.0956537043822976375655904"
}
Name | Type | Description |
---|---|---|
currencyUuid | String | The currency of this rate |
price | String | The latest price of this coin |
volume | String | The latest volume of this coin |