For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

Parameter
Type
Description

candle_duration_in_minutes

Int32

Aggregation window (1, 5, 15, etc.)

Columns

Column
Type
Description

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

Data
Free
Developer
Professional
Business
Enterprise

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

A request that partially overlaps your tier's window returns only the in-window data. On the REST API (/ohlcv), a request whose entire range is older than your window returns HTTP 422 with a working example_url and a discord_url instead of an empty response. See Pricing for details.


Performance

The underlying public_data.candle_1m table exceeds 4 TB. Always include:

  1. Time filters (e.g., start BETWEEN ...)

  2. Market/exchange filters

  3. 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

Get OHLCV for a Market

get

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.

Authorizations
x-api-keystringRequired

Required for /ohlcv and /trade endpoints. Pass your API key in the x-api-key header. Public /market/* endpoints do not require authentication.

Query parameters
exchangestringRequired

The name of the exchange to filter by

marketstringRequired

The universal market symbol to filter by

candle_duration_in_minutesinteger · min: 1 · max: 1440Required

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
start_datetimestring · date-timeRequired

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).

Example: 2024-06-01
end_datetimestring · date-timeRequired

The 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).

Example: 2024-06-08
Responses
200

OK

application/json
startstring · date-timeOptional

Start time of the candle

endstring · date-timeOptional

End time of the candle

duration_minutesintegerOptional

Duration of the candle in minutes

opennumber · decimalOptional

Opening price of the candle

highnumber · decimalOptional

Highest price during the candle period

lownumber · decimalOptional

Lowest price during the candle period

closenumber · decimalOptional

Closing price of the candle

volumenumber · decimalOptional

Volume traded during the candle period

countintegerOptional

Number of trades during the candle period

get/ohlcv
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?