Get the moving averages for a coin throughout time, in both the simple (SMA) and exponential (EMA) flavours. The supported windows are 20, 50, 100 and 200 periods, and a period is one candle of the interval you request — so interval=day gives the familiar 20/50/100/200-day averages, while interval=hour gives 20/50/100/200-hour ones.
A simple moving average (ma20 … ma200) weights every candle in its window equally. An exponential moving average (ema20 … ema200) weights the most recent candles more heavily, so it turns sooner when the price changes direction. Both are expressed in the reference currency, and both become available on the same candle — an EMA is seeded from the simple average of its first window.
The response also carries Bollinger Bands around the 20-period average: bbUpper20 and bbLower20 sit two standard deviations either side of it, so the band widens when the price is volatile and narrows when it settles. There is no middle-band field because a Bollinger middle band is the simple moving average of the same window — it is already published as ma20.
The band is published at two standard deviations, and that is not a limitation. The deviation itself is (bbUpper20 - ma20) / 2, so a band at any other width can be derived from the response without another request.
The window follows the interval rather than always meaning days. A request without an interval uses the default for the chosen timePeriod (see the table below), so pass interval=day explicitly if you want day-denominated averages. Note that interval=day is only available from timePeriod=7d upwards — the shorter periods (1h, 3h, 12h and 24h) do not span enough days to allow it.
https://api.coinranking.com/v2/indicators/:uuid/moving-averages
| Parameter | Description |
|---|---|
uuid String | UUID of the coin you want to request the moving averages for. |
| Parameter | Description | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
timePeriod (optional) String |
The time period for which the moving average data is returned. The number of data points and the default interval are determined by the time period. Every time period up to Allowed values: 1h 3h 12h 24h 7d 30d 3m 1y 3y 5y 10y all Example:
https://api.coinranking.com/v2/indicators/Qwsogvtv82FCd/moving-averages?timePeriod=7d
|
||||||||||||||||||||||||||
interval (optional) String |
The interval determines the granularity of each data point. If not provided, a default interval is used based on the selected timePeriod. Only certain intervals are available per timePeriod — see the table below.
Example:
https://api.coinranking.com/v2/indicators/Qwsogvtv82FCd/moving-averages?timePeriod=7d&interval=day
|
||||||||||||||||||||||||||
referenceCurrencyUuid (optional) String |
UUID of coin (either fiat or crypto), in which all the moving average values are 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 Default value: yhjMzLPhuIDlExample:
https://api.coinranking.com/v2/indicators/Qwsogvtv82FCd/moving-averages?referenceCurrencyUuid=5k-_VTxqtCEI
|
jsonHTTP/1.1 200 OK
{
"status": "success",
"data": [
{
"startingAt": 1774936800,
"ma20": "61051.50263116225",
"ma50": "59938.44387892327",
"ma100": "67917.84166179039",
"ma200": "79262.68876699556",
"ema20": "61204.88911204417",
"ema50": "60312.77410038255",
"ema100": "66984.31220149077",
"ema200": "77105.44992018813",
"bbUpper20": "62890.11447209318",
"bbLower20": "59212.89079023132"
},
{
"startingAt": 1774933200,
"ma20": "61050.102576064244",
"ma50": "59937.069348890385",
"ma100": "67916.28414532698",
"ma200": "79260.87108640283",
"ema20": "61203.11764018829",
"ema50": "60311.02218804471",
"ema100": "66982.90116644302",
"ema200": "77103.61884770195",
"bbUpper20": "62888.42137705441",
"bbLower20": "59211.78377507408"
}
]
}
| Property | Description |
|---|---|
status String | Status of the request Allowed values:success |
data Object[] | List of moving average data points |
data.startingAt Number | An Epoch startingAt in seconds marking the start of the time period. |
data.ma20 String/null | The 20-period simple moving average price in the reference currency: the mean closing price over the last 20 candles of the requested |
data.ma50 String/null | The 50-period simple moving average price in the reference currency: the mean closing price over the last 50 candles of the requested |
data.ma100 String/null | The 100-period simple moving average price in the reference currency: the mean closing price over the last 100 candles of the requested |
data.ma200 String/null | The 200-period simple moving average price in the reference currency: the mean closing price over the last 200 candles of the requested |
data.ema20 String/null | The 20-period exponential moving average price in the reference currency, over the last 20 candles of the requested |
data.ema50 String/null | The 50-period exponential moving average price in the reference currency, over the last 50 candles of the requested |
data.ema100 String/null | The 100-period exponential moving average price in the reference currency, over the last 100 candles of the requested |
data.ema200 String/null | The 200-period exponential moving average price in the reference currency, over the last 200 candles of the requested |
data.bbUpper20 String/null | The upper Bollinger Band: |
data.bbLower20 String/null | The lower Bollinger Band: |
jsonHTTP/1.1 404 Not Found
{
"status": "fail",
"type": "COIN_NOT_FOUND",
"message": "Coin not found"
}