Get coin ATR

Growth This endpoint requires the growth plan or higher. Free, Basic and Startup plans can use preview access.

Get the Average True Range (ATR) for a coin throughout time. The ATR measures volatility: it is the average height of a candle, counting any gap from the previous candle's close as part of that height. A rising ATR means the coin is moving further per candle than it was, in either direction — the ATR says nothing about which way.

The period is 14 candles, and a candle is one bucket of the interval you request — so interval=day gives the familiar 14-day ATR, while interval=hour gives a 14-hour one.

The ATR is a price, not a percentage. It is denominated in whatever referenceCurrencyUuid you request, so an ATR of 412 on Bitcoin in US Dollars means the average candle spans about $412. Comparing volatility between two coins therefore means dividing by their prices yourself — a $412 range on a $100,000 coin is a much quieter market than a $412 range on a $2,000 one.

This uses Wilder's smoothing, the original definition, rather than a plain mean of the last 14 ranges. Every value therefore depends on the one before it, and we read a long run of earlier candles before the first one we return so that the series has converged by the time you see it. That is also why the first returned candle already carries a value rather than starting blank.

https://api.coinranking.com/v2/indicators/:uuid/atr

Preview access

Free, Basic and Startup plans can test this endpoint with five successful requests per account per UTC day. Use the documented endpoint URL with your existing API key. Preview access is applied automatically. The allowance resets at 00:00 UTC.

All API keys, resource IDs, query parameters and pagination requests share this endpoint's allowance for your account. Failed requests do not consume the preview allowance. Successful previews also count toward your normal API usage, and your plan's result, historical-window and rate limits still apply. See endpoint previews for limits, response headers and quota errors.

Path parameters

Parameter Description
uuid String UUID of the coin you want to request the ATR for.

Query parameters

Parameter Description
timePeriod (optional) String

The time period for which the ATR data is returned. The number of data points and the default interval are determined by the time period.

Default value: 24h
Allowed values:
1h 3h 12h 24h 7d 30d 3m 1y 3y 5y 10y all

Example:
https://api.coinranking.com/v2/indicators/Qwsogvtv82FCd/atr?timePeriod=7d
interval (optional) String

The interval determines the granularity of each data point, and therefore what one ATR period means. If not provided, a default interval is used based on the selected timePeriod. Only certain intervals are available per timePeriod — see the table below.


timePeriod Available intervals (default in bold)
1h minute, 5minutes
3h minute, 5minutes, hour
12h minute, 5minutes, hour
24h minute, 5minutes, hour, 8hours
7d hour, 8hours, day
30d hour, 8hours, day, week
3m hour, 8hours, day, week, month
1y day, week, month
3y day, week, month
5y day, week, month
10y day, week, month
all day, week, month

Example:
https://api.coinranking.com/v2/indicators/Qwsogvtv82FCd/atr?timePeriod=7d&interval=day
referenceCurrencyUuid (optional) String

UUID of coin (either fiat or crypto), in whose terms the price is measured before the ATR is calculated. Defaults to US Dollar, but you can use any coin. You can find UUIDs for reference currencies in any coin endpoint, including a convenient dedicated reference currency endpoint

The returned atr is a price in this currency, so this choice sets both the calculation and the units it comes back in. The conversion happens before the calculation, so the ATR of a coin priced in Bitcoin is a genuinely different series from its ATR priced in US Dollars — not a rescaling of it.

Default value: yhjMzLPhuIDl

Example:
https://api.coinranking.com/v2/indicators/Qwsogvtv82FCd/atr?referenceCurrencyUuid=5k-_VTxqtCEI

Code examples

curl
curl 'https://api.coinranking.com/v2/indicators/Qwsogvtv82FCd/atr?timePeriod=7d&interval=hour&referenceCurrencyUuid=5k-_VTxqtCEI' \
  -H 'x-access-token: your-api-key' \
  -G
JavaScript
const options = {
  headers: {
    'x-access-token': 'your-api-key',
  },
};

fetch('https://api.coinranking.com/v2/indicators/Qwsogvtv82FCd/atr?timePeriod=7d&interval=hour&referenceCurrencyUuid=5k-_VTxqtCEI', options)
  .then((response) => response.json())
  .then((result) => console.log(result));
PHP
<?php
  $curl = curl_init();

  curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.coinranking.com/v2/indicators/Qwsogvtv82FCd/atr?timePeriod=7d&interval=hour&referenceCurrencyUuid=5k-_VTxqtCEI",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "x-access-token: your-api-key"
      ),
  ));

  $response = curl_exec($curl);

  curl_close($curl);
  echo $response;
Python
import requests

headers = {
  'x-access-token': 'your-api-key'
}

response = requests.request("GET", "https://api.coinranking.com/v2/indicators/Qwsogvtv82FCd/atr?timePeriod=7d&interval=hour&referenceCurrencyUuid=5k-_VTxqtCEI", headers=headers)

print(response.text)

Response

json
HTTP/1.1 200 OK
{
  "status": "success",
  "data": [
    {
      "startingAt": 1774936800,
      "atr": "412.8371029163"
    },
    {
      "startingAt": 1774933200,
      "atr": "408.5192837465"
    }
  ]
}

Response fields

Property Description
status String

Status of the request

Allowed values:
success
data Object[]

List of ATR data points, newest first

data.startingAt Number

An Epoch startingAt in seconds marking the start of the time period.

data.atr String

The 14-period Average True Range over the last 14 candles of the requested interval, as a price in the reference currency. Higher means larger candles, in either direction.

Error response

json
HTTP/1.1 404 Not Found
{
  "status": "fail",
  "type": "COIN_NOT_FOUND",
  "message": "Coin not found"
}

Error responses

Error Description
FORBIDDEN Object Production access requires the Growth plan or higher. Free, Basic and Startup plans can use preview access.
Error Description
COIN_NOT_FOUND Object The coin could not be found. Try another UUID
Error Description
VALIDATION_ERROR Object The request could not be validated. The response should provide more details.
REFERENCE_UNAVAILABLE Object The reference currency used in the request is not available. Choose another UUID.