Why OHLCV Data Differs Between Providers and How to Fix It
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.
- 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:
| Rank | Cause | Fields affected | Typical size |
|---|---|---|---|
| 1 | Feed scope: consolidated (SIP) vs single venue or primary exchange | Volume, sometimes high/low/close | Volume off by tens of percent up to 95%+ for IEX-only |
| 2 | Timestamp label (open vs close) and one-bar shift | All fields (open, high, low, close, volume) | Whole bar misaligned |
| 3 | Time zone, DST and session boundaries (RTH vs extended, 00:00 UTC vs ET) | Daily OHLC, volume | Whole day or edge bars |
| 4 | Trade filtering by condition codes | High, low, close, volume | A few ticks, small volume share |
| 5 | Late prints, corrections, revisions | Recent bars, volume | Small, shrinks after settle |
| 6 | Aggregation method and empty intervals | Missing bars, volume | Gaps or carried-forward bars |
| 7 | Units: shares vs lots vs contracts, base vs quote | Volume | Exact factor (100, price) |
| 8 | Split and dividend adjustment | Prices, volume | Constant ratio over a range |
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.
| Symptom | Likely cause | Fix |
|---|---|---|
| All fields (OHLC and volume) look shifted by one bar | Open-label vs close-label | Shift one side by one bar interval |
| Daily close differs, intraday matches | Session cut or extended hours | Rebuild daily bars from RTH minute bars |
| Mismatch only on two weeks a year | DST handling | Convert with tz-aware zones, not fixed offsets |
| Volume is ~3% of the other | IEX-only vs SIP | Use a consolidated feed on both sides |
| Volume exactly 100x | Lots vs shares | Multiply by lot size |
| Highs differ by 1 to 3 ticks | Condition-code filtering | Accept 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.
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:
- If best_lag peaks at -1 or +1 instead of 0, fix the label convention first, because it makes every other column look wrong.
- 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.
- If vol_ratio swings at 09:30, 16:00 and in extended hours, suspect session handling or auction prints.
- If open and close match but high and low differ by 1 to 3 ticks, suspect condition-code filtering.
- If only recent bars differ and old bars match, suspect revisions: re-pull after the settle and compare again.
- 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:
| Criterion | Question to ask | Why it matters |
|---|---|---|
| Scope | Consolidated or single venue? | Determines volume and extremes |
| Official prints | Does it use the auction open and close? | Daily bars match exchange records |
| Revisions | Are bars corrected after the fact? | Backtest vs live consistency |
| Licensing | Can you store and redistribute data? | Legal constraint on research data |
| Availability | Same source for backtest and live? | Avoids a hidden model shift |
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.