OHLCV
SQL API
api.ohlcv
api.ohlcv Aggregated OHLCV Candles with Dynamic Resolution This parameterized view provides on-the-fly aggregation of raw 1-minute candles into customizable time intervals (e.g., 5min, 1hr, 4hr).
Basic Usage: 7 days of daily ETH Candles (Binance)
SELECT
start,
open,
high,
low,
close,
volume
FROM api.ohlcv(candle_duration_in_minutes = 1440)
WHERE market = 'ETH-USDT'
AND exchange = 'binance'
AND start >= '2024-06-01'
AND start <= '2024-06-08'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
Normalized 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)
⚠️ Critical Performance Warning
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!
Advanced Example Queries
Exchange Volume Leaderboard
Total BTC-USD volume this month per exchange
Output:
3. Volatility Analysis: 4hr ATR
Output:
4. Fill gaps
Low volume candles are not backfilled by default. This can be done on query:
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.
Use Basic Authentication with:
- Username: Your API Key
- Password: Your API Secret
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 in ISO 8601 format (e.g., '2023-01-01T00:00:00Z')
or any format that can be parsed by the parseDateTime64BestEffort
The end time for the OHLCV data in ISO 8601 format (e.g., '2023-01-02T00:00:00Z')
or any format that can be parsed by the parseDateTime64BestEffort
OK
OK
Last updated
Was this helpful?