DATA · TIMESTAMPS

Crypto OHLCV Timestamps: Candle Open Time vs Close Time

A candle's timestamp can mark when it opened or when it closed. Mixing the two shifts every signal by one bar.

Short answer

Most crypto APIs label candles by open time: Binance's kline arrays put open time at index 0 and close time at index 6, and bars are identified by open time. If you treat an open-time label as a close time, every calculation shifts one bar earlier, creating lookahead (you use a bar's data before it finished). Normalise all sources to one convention, store both open and close times if available, and use UTC milliseconds or ISO strings consistently.

Two conventions

LabelA 1h candle labelled 10:00 covers
Open time10:00:00 – 10:59:59
Close time09:00:00 – 09:59:59
Open-time label (Binance klines)Open-time label (Binance klines): 10:00: Open time = label; 10:30: Bar in progress; 10:59:59.999: Close time (index 6); 11:00: Next bar label.10:00Open time = label10:30Bar in progress10:59:59.999Close time (index 6)11:00Next bar label
The label is when the bar starts. Original ChartsPod editorial graphic.

Put Crypto OHLCV Timestamps next to price, flow and positioning in one workspace.

Open a ChartsPod workspace

The lookahead risk

If your code believes the 10:00 bar closed at 10:00, it may act on that bar's close at 10:00 in a backtest, but in reality that close was known only at 11:00. Every signal gets one bar of foresight.

Illustrative backtest return with timestamp error (%)Illustrative backtest return with timestamp error (%): Correct alignment +6 %; Open treated as close +27 %.ILLUSTRATIVE BACKTEST RETURN WITH TIMESTAMP ERROR (%)Correct alignment+6 %Open treated as close+27 %
A one-bar shift can create large fake returns. Original ChartsPod editorial graphic.

Rules

Timestamp hygieneTimestamp hygiene: Know each source's convention; Normalise to open time (or close) everywhere; Store both times if provided; Use UTC; Signals at close time, fills after.TIMESTAMP HYGIENEKnow each source's conventionNormalise to open time (or close) everywhereStore both times if providedUse UTCSignals at close time, fills after
Write the convention in your data README. Original ChartsPod editorial graphic.

Related: How to Backtest Crypto Strategies Without Lookahead Bias, Why Two Crypto Chart Providers Disagree on the Same Candle.

A quick alignment test

Pick a known event with a sharp move at a precise time, such as a large liquidation candle. Load the same market from two sources and check that the move lands in the same labelled bar after your normalisation. If it lands one bar apart, one source uses a different convention or time zone. Run this test whenever you add a data source.

Conclusion

Normalise candle timestamps to one convention in UTC and make sure signals use only bars whose close time has passed.

Review Crypto OHLCV Timestamps with bar replay before using it live.

Open ChartsPod replay

Questions readers ask

Are Binance kline timestamps open or close?

Bars are identified by open time; close time is also included.

Why does it matter?

Misalignment shifts signals and creates lookahead.

Which convention should I use?

Either, consistently; open time is common.

Sources and methodology

API behaviour comes from DEX Screener's API reference, CoinGecko's onchain API documentation and Binance's USD-M market data documentation as read on 17 October 2026. Code-level details are described conceptually; check current endpoint versions before building. Examples use illustrative values.

  1. Binance: USD-M market data (long/short ratios, OI statistics, klines) — ratio definitions, 30-day retention, kline open/close time.
  2. CoinGecko API: Onchain OHLCV WebSocket — pool candles, base/quote selection, nullable fields.
  3. TradingView Pine Script: Repainting — live vs historical calculation.

This article explains research tools and workflows. It is not financial advice, does not recommend buying or selling any asset and does not predict prices. Crypto derivatives carry a risk of rapid and total loss of margin.

CHARTSPOD EDITORIAL EDITION · RESEARCH AND EDUCATION ONLY · NOT FINANCIAL ADVICE.