Get coin Supertrend

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

Get the Supertrend for a coin throughout time — a trend-following line that sits below the price while the trend is up and above it while the trend is down, together with the direction it is currently reading. It is drawn from the Average True Range: the line trails the price by 3 ATRs, so it gives a volatile coin more room before it calls a reversal than a quiet one.

The settings are the conventional (10, 3) — a 10-candle ATR, placed 3 ATRs from the midpoint of each candle — and a candle is one bucket of the interval you request, so interval=day gives a 10-day Supertrend and interval=hour a 10-hour one.

Read the trend from direction, not by comparing supertrend against the price. The two agree on almost every candle, and disagree on exactly the one that matters: on the candle a reversal lands, the line has already moved to the other side while the closing price has not yet crossed it. direction is the value the calculation itself carried forward, so it is the one that is right on a flip.

The line is path-dependent: while a trend holds it only ever tightens toward the price, and it releases when the price closes through it. A value therefore depends on everything that has happened since the last reversal rather than on a fixed window, which is why we read a long run of earlier candles before the first one we return.

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

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 Supertrend for.

Query parameters

Parameter Description
timePeriod (optional) String

The time period for which the Supertrend 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/supertrend?timePeriod=7d
interval (optional) String

The interval determines the granularity of each data point, and therefore what one Supertrend 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/supertrend?timePeriod=7d&interval=day
referenceCurrencyUuid (optional) String

UUID of coin (either fiat or crypto), in whose terms the price is measured before the Supertrend 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 supertrend is a price in this currency, and the conversion happens before the calculation — so this choice can change direction too, not just the units. A coin trending up against the US Dollar may be trending down against Bitcoin, and this endpoint will say so.

Default value: yhjMzLPhuIDl

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

Code examples

curl
curl 'https://api.coinranking.com/v2/indicators/Qwsogvtv82FCd/supertrend?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/supertrend?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/supertrend?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/supertrend?timePeriod=7d&interval=hour&referenceCurrencyUuid=5k-_VTxqtCEI", headers=headers)

print(response.text)

Response

json
HTTP/1.1 200 OK
{
  "status": "success",
  "data": [
    {
      "startingAt": 1774936800,
      "supertrend": "102847.3910284756",
      "direction": "up"
    },
    {
      "startingAt": 1774933200,
      "supertrend": "102847.3910284756",
      "direction": "up"
    }
  ]
}

Response fields

Property Description
status String

Status of the request

Allowed values:
success
data Object[]

List of Supertrend data points, newest first

data.startingAt Number

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

data.supertrend String

The Supertrend (10, 3) line, as a price in the reference currency. It sits below the price while direction is up and above it while direction is down. Repeated values are normal — the line holds its level until the price moves it.

data.direction String

Which side of the price the line is on, and so which way the trend is currently reading. Always present alongside supertrend.

Allowed values:
updown

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 This endpoint requires the growth plan or higher.
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.