yfinance icon indicating copy to clipboard operation
yfinance copied to clipboard

Inconsistent reporting of a current day's price

Open CamdenSpehl opened this issue 4 years ago • 3 comments

When trying to retrieve stock data for the current day, it does it extremely inconsistently, if at all. Setting period='2d' only gives me yesterdays data, and period='1d' also will only give me yesterdays data. Even if i lower the interval.

SOMETIMES it will give me the current days data, but its extremely inconsistent on if it does or not. Sometimes it will also show 'nan' for today's data, and other times todays date will just be left off the data entirely. This bug occurs with the yf.Tickers object, yf.download, and yf.TickerI'm not sure if this is a bug with yfinance or a change that yahoo finance made internally.

CamdenSpehl avatar Aug 31 '21 18:08 CamdenSpehl

It looks like this is just an issue with YahooFinance not providing the most recent days' ticker values in Historical Data

keefemitman avatar Aug 31 '21 19:08 keefemitman

I have the same issue. sometimes the current day's data is returned and sometimes it's not. Unfortunately, I have not found any solutions for this. I noticed that even when I checked the prices on Yahoo Finance website, for a brief moment after the page is loaded, the data is the same old data I get from History(ticker)

danaeimj avatar Sep 28 '21 18:09 danaeimj

Problem still happening?

ValueRaider avatar Jan 06 '23 21:01 ValueRaider

yes this does still happen, has anyone been able to workaround this?

jkoestner avatar Jun 13 '23 17:06 jkoestner

Provide minimal code that reproduces problem.

ValueRaider avatar Jun 13 '23 17:06 ValueRaider

I will provide the output results tomorrow when it is intraday, but here was the code I used to see inconsistencies. The code seems to work consistently at market close.

import yfinance as yf
test = yf.download('SPY', start=datetime(2023, 6, 12))
test

jkoestner avatar Jun 13 '23 23:06 jkoestner

import logging
logger = logging.getLogger('yfinance')
logger.setLevel(logging.DEBUG)  # verbose: print errors & debug info
test = yf.download('SPY', start=datetime(2023, 6, 10))
test

This is what I saw when including debug image

jkoestner avatar Jun 15 '23 17:06 jkoestner

Nevermind, I think I see the issue now.

I see the end parameter is defaulted 1 day prior to now(), so I understand now why.

end: str
    Download end date string (YYYY-MM-DD) or _datetime, exclusive.
    Default is now
    E.g. for end="2023-01-01", the last data point will be on "2022-12-31"

jkoestner avatar Jul 03 '23 16:07 jkoestner