Inconsistent reporting of a current day's price
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.
It looks like this is just an issue with YahooFinance not providing the most recent days' ticker values in Historical Data
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)
Problem still happening?
yes this does still happen, has anyone been able to workaround this?
Provide minimal code that reproduces problem.
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
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
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"