BitcoinDatabase.com
All posts
Guides

How to Get Bitcoin OHLC Data: OHLCV Candles and Price History

How to get Bitcoin OHLC data: what OHLCV candles are, where daily and intraday price history comes from, and how to pull it over an API or SQL and join it to on-chain activity.

By the BitcoinDatabase team

July 2026 · 8 min read

The short answer

To get Bitcoin OHLC data, pull OHLCV candles, the open, high, low, close and volume for each time bucket, from a market data source over an API or in SQL. Daily candles cover long history for backtests, while intraday candles (hourly or minute) suit short-term charts. The most useful setup keeps the candles in the same place as on-chain data, so you can line a day close up against what happened on the chain that day in one query rather than stitching two feeds together.

OHLC data is the backbone of almost every price chart and backtest. If you have ever seen a candlestick chart, you have read OHLC: each candle is one time bucket, and its body and wicks are drawn from four numbers. Getting that data cleanly, across enough history and at the right interval, is the first step in any pricing model or dashboard. Here is what OHLC actually is, where it comes from, and how to pull it without building a market data pipeline yourself.

What is OHLC and OHLCV data?

OHLC stands for open, high, low and close: the first traded price in a time bucket, the highest, the lowest, and the last. Add volume and you get OHLCV, the five numbers that define a candlestick. Each candle summarizes all the trading in one interval, so a daily candle compresses a full day of ticks into five values. That compression is what makes OHLC so practical: you can hold years of price history in a compact series and still reconstruct a chart or run a backtest from it. The interval you choose, daily, hourly, or one minute, decides the resolution.

Where does Bitcoin OHLC data come from?

OHLC candles are built by aggregating raw trades from exchanges. A data provider collects the tick-by-tick trade stream, then buckets those trades into intervals and computes the open, high, low, close and volume for each bucket. Because Bitcoin trades on many venues, providers either report per-exchange candles or blend venues into a single reference price. What you consume is the finished candle, but it is worth knowing it is a summary of underlying trades, which is why volume and the exact close can differ slightly between sources depending on which venues they include.

How do you get Bitcoin OHLC data from an API?

The direct route is a request to a price history endpoint: you ask for a symbol, an interval and a date range, and you get back an array of candles. For a backfill you request the full history once to seed your database, then poll for the latest candles as new intervals close. The practical questions are how far back the history goes, which intervals are offered, and whether you can join the candles to anything else. A Bitcoin OHLC API that returns daily and intraday OHLCV across the full history covers the first two; the third is where keeping price next to on-chain data pays off.

Interval Best for Trade-off
Daily Long backtests, trend and cycle studies Hides intraday moves within the day
Hourly Medium-term charts and analysis Larger series, more storage
Minute Short-term detail, execution studies Very large volume of candles to manage

You can always resample finer candles up to a coarser interval, but never the other way, so pull the finest resolution you will need.

Can you join OHLC data to on-chain data?

Yes, and this is the reason to keep both in one place. On its own, a candle tells you price moved; it does not tell you why. If your OHLCV series sits in the same schema as the indexed chain, you can join a day close to that day's exchange inflows, active addresses, realized price or supply in profit in a single query. That turns a price chart into an explanation: you can see which candles lined up with coins moving to exchanges or old supply waking up. Analysts who want to ask these questions in plain language often lean on an assistant that turns a question into a query rather than hand-writing every join.

How much Bitcoin price history can you get?

Bitcoin has traded since 2010, so daily history can reach back well over a decade, while intraday history depends on the provider and is usually shorter the finer the interval. For a backtest, more history is generally better, but check that early candles are clean, since the first years of Bitcoin trading were thin and prices differed sharply between venues. A provider that holds the full series lets you backfill once and then keep it current, so you are not stitching together several sources with different formats and gaps.

How do you get Bitcoin OHLC data with BitcoinDatabase?

BitcoinDatabase serves OHLCV candles at daily and intraday intervals across the full history, and because those candles live alongside the fully-indexed chain, you can pull them over REST for a chart or query them in SQL and join them to on-chain metrics in the same call. Backfill years of history in one pass, resample to your own timeframe, and read the latest candles as new data lands. It is the same three-way access, REST, SQL and dashboards, used for the rest of the chain. To go deeper on the underlying data, see the Bitcoin historical data API and Bitcoin price API. This is informational market and on-chain data, not a trading signal or investment advice.

Query Console
btc
try:

Hit Run to query the fully-indexed Bitcoin blockchain.

BTC

30-day trend

informational on-chain data · not financial advice

REST API · SQL · dashboards, one indexed dataset. Querying the indexed Bitcoin blockchain ...

Query the Bitcoin blockchain yourself

Pull balances, UTXOs, transactions, on-chain metrics and fund flows from the fully indexed Bitcoin blockchain by REST API, SQL and dashboards. Indexed since 2009, new blocks within seconds, no node to run.

Query the whole Bitcoin blockchain

BitcoinDatabase indexes the public Bitcoin blockchain block by block and returns balances, UTXOs, transactions, on-chain metrics and fund flows by REST API, SQL and dashboards, with no node to run.

REST + SQL + dashboards · indexed since 2009 · new blocks within seconds

Informational on-chain data only · not financial, investment or legal advice · AML features are compliance tooling to support your own review.