Get coin OHLCV

Professional This endpoint requires the professional plan or higher

Get OHLCV (Open High Low Close Volume) data for the coin throughout time.

https://api.coinranking.com/v2/coin/:uuid/ohlcv

This endpoint has two modes:

  • Latest candles (default): without a from parameter, the endpoint returns the most recent limit candles for the chosen interval — the classic behaviour.
  • Historical window: supply a from (and optional to) timestamp to fetch a specific time range instead. Minute-resolution history is available all the way back to December 2018, so you can pull deep historical candlestick data and page through arbitrarily long ranges.

Path parameters

ParameterDescription
uuid StringUUID of the coin you want to request the OHLCV data for.

Query parameters

Parameter Description
interval (optional) String

The interval determines the time period over which each OHLC item is determined.

Default value: day
Allowed values:
minute 5minutes hour 8hours day week month

Example:
https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?interval=hour
limit (optional) Number

Limit. Limit the amount of time periods for which the OHLCV data is retrieved. For example, when interval=hour and limit is 10, data will be returned for the last 10 hours. The maximum amount of time periods you can fetch in one request is 5000. This endpoint requires the Professional plan, so the Free and Startup limits that apply to other endpoints do not apply here.

Ignored in historical window mode (when from is supplied); windows are instead capped at 1440 candles per response and paged with data.paging.next — see Fetching historical ranges.

Default value: 50
Size range: 0-5000


Example:
https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?limit=10
from (optional) Number

Start of the historical window as a Unix timestamp in seconds. Supplying from switches the endpoint into historical window mode: instead of the latest limit candles, it returns candles for the requested time range. from is snapped down to the start of its interval, so the bucket containing from is included.

Minute-resolution history is available back to December 2018. When omitted, the endpoint stays in the default latest-candles mode.

Size range: 0-4102444800


Example:
https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?interval=hour&from=1614556800&to=1617235200
to (optional) Number

End of the historical window as a Unix timestamp in seconds. The window is half-open: candles are returned for every interval bucket that starts before to. Unlike from, to is not snapped, so if it falls mid-interval the bucket it lands in is still returned (effectively rounding to up to the next boundary); only a candle starting exactly at to is excluded. Requires from, and must be greater than from. When omitted, the window runs up to the present moment.

Default value: now
Size range: 0-4102444800


Example:
https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?interval=hour&from=1614556800&to=1617235200
referenceCurrencyUuid (optional) String

UUID of coin (either fiat or crypto), in which all the prices 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

Note: When using a reference currency, the OHLC values are converted from USD-based calculations rather than recalculated from raw trading data. Since reference currency exchange rates fluctuate during the time period this means:

  • The Open or Close values might be higher than the High or lower than the Low
  • For true OHLC data in a specific currency pair, use USD as the reference currency or subscribe to the realtime rates for both the coin and the intended reference currency and calculate the OHLC values yourself
Default value: yhjMzLPhuIDl

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

Fetching historical ranges

Supplying a from timestamp puts the endpoint in historical window mode. It returns the candles that fall inside the half-open range [from, to) for the chosen interval, ordered newest-first, with minute-resolution data available back to December 2018.

The 1440-candle cap and paging

A single response returns at most 1440 candles. When the response does not cover the whole requested window, it is truncated to the portion nearest from and a continuation cursor is returned on data.paging.next (a Unix timestamp in seconds). To fetch the next page, repeat the request with from set to that value and the same to. When the window has been returned in full, data.paging.next is null.

Always drive paging from data.paging.next, not from the candle count. A page can contain fewer than 1440 candles and still have more to follow — a non-null next always means there is another page. Keep requesting until next is null.

Walking a range this way is gapless and overlap-free, and identical requests always return identical candles. Historical windows are immutable and returned with a long cache lifetime (Cache-Control: max-age=3600; recent windows use max-age=60), so responses can be cached aggressively.

text
# 1) Request a wide range GET /v2/coin/Qwsogvtv82FCd/ohlcv?interval=minute&from=1609459200&to=1612137600 # 2) Response was truncated, e.g. data.paging.next = 1609545600 # Fetch the next page by advancing `from` to that value: GET /v2/coin/Qwsogvtv82FCd/ohlcv?interval=minute&from=1609545600&to=1612137600 # 3) Keep going until data.paging.next is null

Data availability in historical candles

Older candles carry less detail than recent ones, because the historical archive did not always store every field:
  • avg is null throughout deep history — it is not reconstructable from the archived data.
  • For older periods where only the closing price was preserved, open, high and low are derived from the close, so those candles are flat (all four equal). They are null only for buckets that have no data at all (where close is null too).
  • intervalVolume is null for periods where the source did not record interval volume.
  • 24hVolume in a historical candle is the rolling 24-hour volume recorded at the end of that bucket — a point-in-time snapshot, never a sum of the interval.

Intervals and access

All intervals (minute through month) can be queried with from/to. This endpoint requires the Professional plan, and historical requests are subject to a daily fair-use quota; exceeding it returns a 429 response (see Error response).

Code examples

Response

json
HTTP/1.1 200 OK { "status": "success", "data": { "ohlc": [ { "startingAt": 1733011200, "endingAt": 1735689600, "open": "96447.1775503152", "high": "108201.88415847138", "low": "91546.14889956331", "close": "92757.25601337428", "avg": "98498.05461116068", "24hVolume": "46442676990.360725", "intervalVolume": "2002368626068.8618" }, { "startingAt": 1730419200, "endingAt": 1733011200, "open": "70322.96990325804", "high": "99588.89995964085", "low": "66922.19464691161", "close": "96449.1102387863", "avg": "86276.37524878597", "24hVolume": "38017759048.21358", "intervalVolume": "3928981914099.0195" } ] } }

In historical window mode (when from is supplied), the response additionally includes a data.paging object holding the continuation cursor:

json
HTTP/1.1 200 OK { "status": "success", "data": { "ohlc": [ { "startingAt": 1609545540, "endingAt": 1609545600, "open": "29280.11", "high": "29342.57", "low": "29271.04", "close": "29331.86", "avg": null, "24hVolume": "51477880123.44", "intervalVolume": null } ], "paging": { "next": 1609545600 } } }

Response fields

PropertyDescription
status String

Status of the request

Allowed values:
success
data Object
data.ohlc Object[]

List of OHLC items

data.ohlc.startingAt Number

An Epoch timestamp in seconds marking the start of the time period on which the OHLC values are based.

data.ohlc.endingAt Number

An Epoch timestamp in seconds marking the end of the time period (exclusive).

data.ohlc.open String/null

Opening price of the coin for the time period in the reference currency

data.ohlc.high String/null

Highest USD price of the coin during the time period in the reference currency. When using non-USD reference currencies, the highest USD price is directly converted to the reference currency. Since the reference currency itself can fluctuate against the US Dollar, the High is not necessarily the highest price in the chosen reference currency.

data.ohlc.low String/null

Lowest USD price of the coin during the time period in the reference currency. When using non-USD reference currencies, the lowest USD price is directly converted to the reference currency. Since the reference currency itself can fluctuate against the US Dollar, the Low is not necessarily the lowest price in the chosen reference currency.

data.ohlc.close String/null

Closing price of the coin for the time period in the reference currency

data.ohlc.avg String/null

Average price of the coin over the time period. Always null for deep historical candles, where it is not reconstructable.

data.ohlc.24hVolume String/null

Total 24h volume of the coin in the reference currency. In historical candles this is a rolling 24-hour snapshot taken at the end of the bucket, not a sum of the interval.

data.ohlc.intervalVolume String/null

Total volume of the coin for the specified time interval in the reference currency. In the default latest-candles mode this is populated for the week and month intervals only. In historical window mode it is also populated for finer intervals where the data source recorded interval volume; otherwise it is null.

data.paging Object

Only present in historical window mode (when from is supplied).

data.paging.next Number/null

Epoch timestamp in seconds to use as the next from value to continue the range, or null when the window has been returned in full. See Fetching historical ranges.

Error response

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

Error responses