Rates provide aggregated price and volume data for cryptocurrencies across all exchanges. They represent the consolidated market data that Coinranking calculates for each coin.
The fastest way to get new rates is to subscribe to our WebSockets. You can request rates through our coins endpoints too, but they will only update once a minute. With our WebSockets you can establish a persistent connection through which new rates are pushed, so you get the latest price and 24 hour volume whenever they are calculated.
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.
wss://api.coinranking.com/v2/real-time/rates
You can subscribe to rates in two ways:
You can specify your subscription preferences directly in the WebSocket connection URL using query parameters. This is the recommended approach when you know your subscription requirements at connection time.
| Parameter | Description |
|---|---|
currency-uuids[] Array |
With the currency 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. You can find UUIDs for all our coins in our dedicated reference currency endpoint
Note: Use array notation in the URL: Example:
wss://api.coinranking.com/v2/real-time/rates?currency-uuids[]=Qwsogvtv82FCd¤cy-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 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 Allowed values: 1s 10s Example:
wss://api.coinranking.com/v2/real-time/rates?throttle=10s
|
list (optional) String |
CRITICAL: This parameter is ONLY available via URL query strings and cannot be used in subscription messages. When using
With the list parameter, you can subscribe to a list of coins. When set to
The default is Allowed values: none all Example:
wss://api.coinranking.com/v2/real-time/rates?list=all
|
After establishing a WebSocket connection, you can update your subscription by sending JSON messages through the socket. This allows you to change which currencies you're subscribed to without reconnecting.
Important: The list parameter is NOT supported in subscription messages. It can only be used in URL query strings when initially connecting.
Send a JSON message with the following structure:
json{
"throttle": "10s",
"currencyUuids": ["Qwsogvtv82FCd", "razxDUgYGNAdQ"]
}
After sending a subscription message, the server will respond with a confirmation message (see Server Responses below).
The WebSocket server sends different types of messages depending on the context:
When subscribed to rates, you receive aggregated price and volume data for cryptocurrencies. Rates represent consolidated market data calculated by Coinranking across all exchanges, providing a single unified price and 24-hour volume for each coin. Each rate message includes the currency UUID to identify which cryptocurrency the data represents, making it easy to track multiple coins simultaneously.
json{
"currencyUuid": "Qwsogvtv82FCd",
"price": "125423.835504191964312353",
"volume": "6270550403.287645846237386287"
}
After sending a subscription update message through the WebSocket, the server responds with a confirmation message:
json{
"type": "confirmation",
"topic": "rate",
"throttle": "10s",
"subscriptions": ["Qwsogvtv82FCd", "razxDUgYGNAdQ"]
}
This confirmation indicates that your subscription has been successfully updated.
When subscribed to one or more coins, you receive new rates whenever they are available. Each of these rates includes the UUID of the coin the rate pertains to, which is especially useful when you are subscribed to multiple coins. Rates include the latest price and 24-hour moving volume, both in US dollars.
Unlike our coin endpoints, we do not support other reference currencies than US dollars with WebSockets. You can, however, subscribe to multiple coins, which allows you to calculate them yourself.
| Property | Description |
|---|---|
currencyUuid String | The currency UUID of this rate. Useful if you subscribed to multiple currencies, in which case the UUID helps you determine to what coin the rate belongs. |
price String | The latest price of a coin, in US Dollar. |
volume String | The latest 24 hour volume of this coin (a moving sum), in US Dollar. |