OHLCV
This parameterized view provides on-the-fly aggregation of raw 1-minute candles into customizable time intervals (e.g., 5min, 1hr, 4hr).
SQL API
api.ohlcv
Aggregated OHLCV candles with dynamic resolution — on-the-fly aggregation of raw 1-minute candles into customizable time intervals.
Parameters
candle_duration_in_minutes
Int32
Aggregation window (1, 5, 15, etc.)
Columns
start
DateTime
Candle open time (UTC)
end
DateTime
Candle close time (UTC)
exchange
String
Exchange name (e.g., "binance")
market
String
Universal symbol (e.g., "BTC-USDT")
open
Decimal(76,20)
First price in interval
high
Decimal(76,20)
Highest price in interval
low
Decimal(76,20)
Lowest price in interval
close
Decimal(76,20)
Last price in interval
volume
Decimal(76,20)
Total base asset volume
count
Int32
Number of trades
duration_minutes
Int32
Candle duration (matches input parameter)
Data Access by Tier
Daily/Hourly OHLCV
Full history
Full history
Full history
Full history
Full history
Spot 1-min OHLCV
Rolling 1 month
Rolling 1 year
Full history
Full history
Full history
Futures OHLCV (1-min and aggregates)
Rolling 1 month
Rolling 1 year
Full history
Full history
Full history
Options OHLCV (1-min and aggregates)
Rolling 1 month
Rolling 1 year
Full history
Full history
Full history
Performance
The underlying public_data.candle_1m table exceeds 4 TB. Always include:
Time filters (e.g.,
start BETWEEN ...)Market/exchange filters
Reasonable aggregation windows
Unfiltered queries will be rejected by the query killer!
Example Queries
1. Basic Usage: 7 days of daily ETH Candles (Binance)
market symbols are quote-specific and not unified across venues: BTC-USD (Coinbase/Kraken/Bitstamp/Gemini/Bitfinex) and BTC-USDT (Binance/OKX/Bybit/KuCoin/Gate.io) are distinct markets.
2. Exchange Volume Leaderboard
Total BTC volume this month per exchange
USD- and USDT-quoted books are distinct markets, so a cross-exchange leaderboard must include both symbols.
Functions used: toStartOfMonth, now.
Output:
3. Volatility Analysis: 4hr ATR
USD- and USDT-quoted BTC are distinct markets; scope to both (or pin a single venue with exchange = '…') to avoid mixing books.
Functions used: avg() OVER.
Output:
4. Fill gaps
Low volume candles are not backfilled by default. This can be done on query:
Functions used: WITH FILL.
Output
REST API
This endpoint retrieves OHLCV (Open, High, Low, Close, Volume) data for a specific market.
It includes spot, future, and option markets.
This endpoint is limited to 10000 candles per request.
Required for /ohlcv and /trade endpoints. Pass your API key in the x-api-key header. Public /market/* endpoints do not require authentication.
The name of the exchange to filter by
The universal market symbol to filter by
The time interval for the candles in minutes. The value can be any amount of minutes:
- 1: 1 minute
- 5: 5 minutes
- 60: 1 hour
- 1440: 1 day
The start time for the OHLCV data. Accepts any format parseable by
parseDateTime64BestEffort — e.g. a plain date (2024-06-01, treated
as midnight UTC) or a full ISO 8601 timestamp (2024-06-01T12:00:00Z).
2024-06-01The end time for the OHLCV data. Accepts any format parseable by
parseDateTime64BestEffort — e.g. a plain date (2024-06-08, treated
as midnight UTC) or a full ISO 8601 timestamp (2024-06-08T12:00:00Z).
2024-06-08OK
Start time of the candle
End time of the candle
Duration of the candle in minutes
Opening price of the candle
Highest price during the candle period
Lowest price during the candle period
Closing price of the candle
Volume traded during the candle period
Number of trades during the candle period
Empty result because the entire requested range is older than your tier's data window; the body carries a working example_url and a Discord invite.
GET /ohlcv?exchange=text&market=text&candle_duration_in_minutes=1&start_datetime=2024-06-01&end_datetime=2024-06-08 HTTP/1.1
Host: api.koinju.io
x-api-key: YOUR_API_KEY
Accept: */*
[
{
"start": "2023-01-01T00:00:00Z",
"end": "2023-01-01T00:01:00Z",
"duration_minutes": 1,
"open": 100,
"high": 105,
"low": 99,
"close": 104,
"volume": 1500,
"count": 25
},
{
"start": "2023-01-01T00:01:00Z",
"end": "2023-01-01T00:02:00Z",
"duration_minutes": 1,
"open": 104,
"high": 106,
"low": 103,
"close": 105.5,
"volume": 1200,
"count": 20
}
]Last updated
Was this helpful?