Howwise RSS
Trading Software9 min read

Why OHLCV Data Differs Between Providers and How to Fix It

Short answer

OHLCV data differs between providers mostly because of feed scope (consolidated vs single venue), time labelling, session boundaries and trade filtering, not code bugs. Diagnose by joining both feeds on UTC timestamps and bucketing the gaps.

Key takeaways
  • Volume is the field that disagrees most, because a single-venue feed such as Alpaca's free IEX feed carries only a few percent of consolidated volume.
  • A one-bar shift across every field (open, high, low, close and volume) usually means one vendor labels bars by open time and the other by close time; cross-correlating returns at lags -1, 0 and +1 detects it.
  • Small high/low gaps of a few ticks come from SIP condition-code filtering (odd lots, out-of-sequence, average-price and form-T trades), not from bad data.
  • Crypto exchanges are separate markets, so Binance and Coinbase candles legitimately differ in price and volume.
  • Use one source for both backtest and live trading, flag bars beyond tolerance, and never splice vendors mid-history without a reconciliation check.

Why does OHLCV data differ between providers?

Two vendors can return the same symbol and timeframe and both be correct, because each makes different choices about which trades count, which clock labels a bar, and when the data was last revised. A mismatch is a bug in your code only if it survives after you normalise timestamps, sessions and units.

Ranked by how often they explain a gap, the causes are:

RankCauseFields affectedTypical size
1Feed scope: consolidated (SIP) vs single venue or primary exchangeVolume, sometimes high/low/closeVolume off by tens of percent up to 95%+ for IEX-only
2Timestamp label (open vs close) and one-bar shiftAll fields (open, high, low, close, volume)Whole bar misaligned
3Time zone, DST and session boundaries (RTH vs extended, 00:00 UTC vs ET)Daily OHLC, volumeWhole day or edge bars
4Trade filtering by condition codesHigh, low, close, volumeA few ticks, small volume share
5Late prints, corrections, revisionsRecent bars, volumeSmall, shrinks after settle
6Aggregation method and empty intervalsMissing bars, volumeGaps or carried-forward bars
7Units: shares vs lots vs contracts, base vs quoteVolumeExact factor (100, price)
8Split and dividend adjustmentPrices, volumeConstant ratio over a range
Tip: A constant ratio between the two volume columns (exactly 100, or equal to price) points to units. A ratio that varies by hour of day points to feed scope or sessions. Random tiny gaps point to filtering or revisions.

Is it consolidated or single-venue data?

US equities trade on many venues. A consolidated (SIP, all-venue) feed combines them all. A single-venue or primary-exchange feed reports one venue, so its volume is a fraction of the total. Alpaca's free IEX feed, for example, shows only a few percent of consolidated volume, and its highs and lows can miss prints that happened elsewhere.

Yahoo Finance and TradingView depend on the data package and exchange you pick, so the same ticker can show different volume in each. If one source's volume is a stable low fraction of the other's, feed scope is the cause.

Crypto has no consolidation. Binance and Coinbase are separate order books with different participants, quote currencies (USDT vs USD) and fees, so their candles are each their own market. Differences in high and low there are real, and no join key will fix them. Compare like pairs only (BTCUSDT with BTCUSDT on two vendors that relay Binance, not BTCUSD on Coinbase).

How do timestamps, time zones and sessions cause mismatches?

Bars are labelled either by their open time (left-labelled) or by their close time (right-labelled). Binance klines carry the open time. Polygon aggregates and Alpaca bars are stamped with the start of the window. Many tools that resample with pandas default to left labels for minute bars, but not for every frequency (week, month and quarter ends default to right labels), so check your own resampling too. Some platforms and older exports stamp the close. Confirm each vendor with a known bar, such as the 09:30 ET first minute: its high should equal the opening-minute spike.

A label mismatch moves the whole bar, so open, high, low, close and volume all look offset by one interval, not just highs and lows. This is why it makes every other comparison look wrong.

Time zones add a second layer. Convert everything to UTC and keep exchange-local logic separate. New York is UTC-5 in winter and UTC-4 in summer, so 09:30 ET is 14:30 or 13:30 UTC, and a fixed-offset conversion breaks twice a year around DST changes.

Session definitions matter just as much. A US equity daily bar cut at 16:00 ET differs from one cut at 00:00 UTC. Futures and 24/5 FX or CFD sessions often start at 18:00 ET, so their 'daily' bar spans two calendar dates. Regular trading hours (09:30 to 16:00 ET) exclude pre-market and post-market prints, which some vendors include by default (IBKR has a useRTH flag; Yahoo has a prepost option). Extended hours add volume and can move the high and low.

SymptomLikely causeFix
All fields (OHLC and volume) look shifted by one barOpen-label vs close-labelShift one side by one bar interval
Daily close differs, intraday matchesSession cut or extended hoursRebuild daily bars from RTH minute bars
Mismatch only on two weeks a yearDST handlingConvert with tz-aware zones, not fixed offsets
Volume is ~3% of the otherIEX-only vs SIPUse a consolidated feed on both sides
Volume exactly 100xLots vs sharesMultiply by lot size
Highs differ by 1 to 3 ticksCondition-code filteringAccept within tolerance or align filters

Why do highs, lows and closes differ by a few ticks?

SIP trades carry condition codes. Vendors decide whether odd-lot trades (under 100 shares), out-of-sequence prints, average-price trades, cross trades, form-T (extended-hours) trades and auction prints may update the high, low, open, close or volume. Two vendors with different rules produce highs and lows a few ticks apart, even on the same consolidated feed.

The official close is the closing auction price, not the last trade before 16:00. Vendors that build the close from the last eligible trade will differ from those that use the auction print, and the gap can be large on volatile days. The same applies to the official open from the opening auction.

Bars are also revised. Late prints and trade corrections or cancellations arrive after the bar closes, so a streamed bar often differs from the end-of-day historical bar. Compare live bars against the historical bar pulled after the settle, and re-pull history after the day ends rather than storing the streamed copy.

Aggregation adds more differences. Bars built from ticks see every eligible trade, while bars built from 1-minute bars inherit the minute-level filtering. A minute with no trades is either missing (most feeds) or carried forward with zero volume (some platforms). Treat the two as different representations and never mix them.

Warning: Units matter. Volume may be in shares, hundreds of shares (lots), contracts, or in crypto base currency vs quote currency (BTC vs USDT). Also, volume is not tick count: some feeds report trade count. Check this before blaming the feed. Adjusted vs unadjusted prices are a separate cause; see the existing adjusted-vs-unadjusted prices article rather than repeating it here.

How do I diagnose the mismatch with pandas?

Normalise both frames to UTC with the same label convention, join on the timestamp, compute relative differences, then bucket by hour, session and volume decile. The pattern of the bucket tells you the cause. The script assumes both frames have a tz-aware UTC DatetimeIndex and open, high, low, close, volume columns.

The lag check at the end cross-correlates returns at shifts of -1, 0 and +1. The shift with the highest correlation identifies a label shift.

import numpy as np
import pandas as pd

def normalise(df, tz_source=None, label='left', freq='1min'):
    df = df.copy()
    idx = pd.DatetimeIndex(df.index)
    if idx.tz is None:
        idx = idx.tz_localize(tz_source or 'UTC')
    df.index = idx.tz_convert('UTC')
    if label == 'right':          # vendor stamps close time
        df.index = df.index - pd.Timedelta(freq)
    d = df.sort_index()
    return d[~d.index.duplicated()]

def compare(a, b):
    j = a.join(b, how='inner', lsuffix='_a', rsuffix='_b')
    out = pd.DataFrame(index=j.index)
    for c in ['open', 'high', 'low', 'close', 'volume']:
        den = j[c + '_b'].replace(0, np.nan)
        out[c] = (j[c + '_a'] - j[c + '_b']) / den
    out['vol_ratio'] = j['volume_a'] / j['volume_b'].replace(0, np.nan)
    et = j.index.tz_convert('America/New_York')
    out['hour_et'] = et.hour
    mins = et.hour * 60 + et.minute
    out['session'] = np.where((mins >= 570) & (mins < 960), 'rth', 'ext')
    out['vol_decile'] = pd.qcut(j['volume_b'].rank(method='first'), 10, labels=False)
    return out

def report(out):
    print('Matched bars:', len(out))
    print(out.groupby('session')[['open','high','low','close']].agg(lambda s: s.abs().median()))
    print(out.groupby('hour_et')['vol_ratio'].median())
    print(out.groupby('vol_decile')['vol_ratio'].median())

def best_lag(a, b, lags=(-1, 0, 1)):
    ra = np.log(a['close']).diff()
    rb = np.log(b['close']).diff()
    return {k: ra.corr(rb.shift(k)) for k in lags}

# a = normalise(vendor_a, label='left')
# b = normalise(vendor_b, label='right')
# report(compare(a, b)); print(best_lag(a, b))

How do I read the results?

Use the output to pick the cause in order:

  1. If best_lag peaks at -1 or +1 instead of 0, fix the label convention first, because it makes every other column look wrong.
  2. If vol_ratio is stable by hour but not 1, suspect units or feed scope. A ratio of exactly 100 or of price is units, and a low fraction like 0.03 is IEX-only vs consolidated.
  3. If vol_ratio swings at 09:30, 16:00 and in extended hours, suspect session handling or auction prints.
  4. If open and close match but high and low differ by 1 to 3 ticks, suspect condition-code filtering.
  5. If only recent bars differ and old bars match, suspect revisions: re-pull after the settle and compare again.
  6. If the mismatch starts on a specific date and is a constant ratio before it, suspect an adjustment (split or dividend) applied by one vendor.

What tolerances should I use, and which source should I trust?

These rules of thumb are for liquid US equities on two consolidated feeds, and they are a starting point to tune per instrument. Open and close should match within one tick. High and low should match within two or three ticks. Volume should match within a small percentage, and a ratio outside roughly 0.9 to 1.1 on consolidated-vs-consolidated data deserves a look.

Treat a mismatch as a data-quality failure when any of these holds: close differs by more than one tick on more than about 0.5% of bars, a high or low differs by more than a few ticks on bars that are not auction or illiquid, a one-bar shift is detected, a volume ratio is stable but far from 1 (scope or units), or bars are missing on one side for liquid symbols. Illiquid names and the open and close minutes need wider bands.

Choose the source by a short checklist:

CriterionQuestion to askWhy it matters
ScopeConsolidated or single venue?Determines volume and extremes
Official printsDoes it use the auction open and close?Daily bars match exchange records
RevisionsAre bars corrected after the fact?Backtest vs live consistency
LicensingCan you store and redistribute data?Legal constraint on research data
AvailabilitySame source for backtest and live?Avoids a hidden model shift
Tip: Use one source for both research and production. A strategy whose volume filter is tuned on consolidated history will behave differently on an IEX-only live stream, even though the code is identical.

What reconciliation policy keeps a backtest honest?

Pick a primary source and treat the second as a validator only. Run the comparison above nightly, flag bars beyond tolerance, and store the flags next to the data so a backtest can exclude or review them.

Never splice vendors mid-history without a check. Before joining two sources at a date, overlap them for at least several weeks, verify label convention, session, units and adjustment, and confirm the tolerances hold on the overlap. A silent splice can introduce a one-bar shift or a volume step that looks like a market event.

For live systems, store the streamed bars and the historical bars separately, and replace the streamed copy with the settled historical copy after the session. That is the same revision policy your backtest will see.

Common questions

Why is volume different between data providers?

Most often one feed is single-venue (such as IEX-only) and the other is consolidated, so one shows only a few percent of the other. Other causes are extended-hours inclusion, odd-lot and auction handling, and units (shares vs lots, or base vs quote currency in crypto).

Why do TradingView and Yahoo Finance show different volume?

They source data from different packages and exchanges, and may include or exclude extended hours and different trade types. Match the session setting and confirm whether each volume is consolidated before comparing.

Why do candles look different on Binance vs Coinbase?

They are separate exchanges with their own order books, quote currencies and participants, so prices and volumes legitimately differ. Compare the same pair and the same timestamp convention, and expect price gaps to reflect real market differences, not errors.

How can I detect a one-bar shift between two vendors?

Compute log returns of each close series, shift one by -1, 0 and +1 bars, and correlate. The lag with the highest correlation shows the shift, and 0 means the labels align.

Should I use the streamed bar or the historical bar?

Use the settled historical bar for storage and backtests, because late prints and corrections revise bars after they close. Keep the streamed bar only for real-time decisions, and compare the two after the session to measure the revision size.

Related topics:ohlcvmarket-datadata-qualitypandasbacktesting