Why Daily and Hourly Stock Bars Can Have Different Prices
Summary
The document explains why daily and hourly OHLC values from a market data provider may not match, even when adjustment settings appear similar. Sampled bars can use different venues, trade types, opening conventions, and corporate-action adjustments. In the example discussed, the daily series appears to account for cash dividends while the hourly series appears unadjusted; single-precision rounding also creates small price discrepancies.
The answer recommends confirming with the data vendor which venues and trades feed each interval and what adjustment rules apply. It also notes that prices and volumes can vary substantially across consolidated, exchange-specific, and other venue-specific data, and that rounding may help address floating-point artifacts. These observations do not verify the exact source configuration for every observation in the example, and they are specific to data methodology rather than a trading signal. Matching bars across intervals therefore requires understanding how each series is constructed.
Key ideas
- Daily and intraday bars can draw on different venues, trade types, or sampling conventions.
- Corporate-action adjustments may differ by interval, so apparently equivalent OHLC fields need not agree.
- Single-precision storage can create small price discrepancies that rounding may resolve.
- Data users should ask vendors which venues, trades, and adjustment methods are applied to each series.
- Volumes can also differ substantially across consolidated and venue-specific data.
Tags
Full text
# YFinance incoherent daily and hourly values # YFinance incoherent daily and hourly values I'm comparing daily and hourly values extracted from YFinance in Python. I'm expecting the open value of the first hour of the market to be equal to the daily open value of the corresponding day, and the close value of the last hour of the market to be equal to the daily close value. Also, the min and the max daily values should be contained in at least one of the hourly values. I enabled back adjustments in both the cases and enabled the pre & post market hours for the hourly data trying to find a corresponding daily value. None of my assumptions holds: hourly and daily values are different (open, high, low and close). E.g: the highest daily value is 32.746275 and the highest hourly value is 33.919899 (at 11:30). What am I doing wrong? ``` import yfinance as yf ticker = 'AY' net = yf.Ticker(ticker) start_date, end_date = '2020-11-06', '2020-11-07' daily_signals_df = net.history(start=start_date, end=end_date, interval='1d', back_adjust=True, auto_adjust=True, prepost=False) hourly_signals_df = net.history(start=start_date, end=end_date, interval='1h', back_adjust=True, auto_adjust=True, prepost=True) ``` ``` >>> daily_signals_df ``` ``` >>> hourly_signals_df ``` ## Answer by Richard at NorgateData (score 8, accepted) https://quant.stackexchange.com/a/66044 When you sample stock market data, you really need to understand what source(s) and rules are being used, and any adjustments applied to the data. Different rules might also exist for different periodicities sampled too. There are may different/methodologies applied to Consolidated tape price versus listed exchange price versus a specific exchange price. For example, the opening price of a NYSE-listed stock might be quite different to the first traded price of that stock across all exchanges. Some data might also be limited to a particular exchange to reduce realtime royalties (e.g. IEX or Cboe trades only). The timing of the open is often different too - NYSE stocks can actually take a few minutes to "open" versus other venues. Secondly, when examining historical data, you need to determine what price adjustment methods are used to back-adjusted prior prices for corporate actions, such as splits/reverse splits, stock dividends (same stock), stock dividends (different stock)/spinoffs, special cash dividends/distributions, long-term/short-term capital gains, returns of capital, ordinary cash dividends/distributions etc. In your example of AY, the daily source appears to be adjusted for cash dividends. The hourly data is NOT adjusted for cash dividends and is probably raw data (I haven't checked the exact values). The hourly data also suffers from single precision floating point inaccuarcies. AY actually opened at $32.01 on 20201106 (not 32.009998). Best advice: Ask your data vendor exactly which venue trades/trade types are incorporated into their data and which price adjustment mechanisms are used. Even better if you can select various parameters yourself. Consider rounding as required to overcome floating point issues. I'll give an interesting example on an S&P 500 NYSE:GE (General Electric) trade date 20210623 with data points representing values as at 20210714. GE had a $0.01 dividend with exdate 20210625. - Total return adjusted consolidated tape open: $13.01009885931559 For volume: - Final Consolidated tape volume: 43,677,544 - Final NYSE-only trade volume: 8,188,906 - Final IEX-only volume: 855,297 - Final diviend-adjusted tape volume: 43,710,784.140 As you can see, the prices and volumes change based upon the methodology/venues used. Full disclosure: Norgate Data is a data vendor of daily periodicity stock data. I am a co-owner of the company.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.