yFinance crash every midnight: No Price data found, Symbol may be delisted.
Describe bug
I'm checking yFinance historical data for my tradingbot. However, every night (around midnight) the bot crashed because yahoo returns the exception:
2023-10-02 **02:00:19,167** - ERROR: LINK-USD: No price data found, symbol may be delisted (period=1d)
Note: I say this is midnight because I live in the GMT+2 timeline and when I visit the interactive chart is in the Greenwich timeline.
I've calculated how many requests I make in a day, and I've set my sleep timer to 40 seconds. So worst case scenario I make a total request per day of: 24h60min60sec = 86400 seconds in a day / 40 seconds = 2160 requests per day, which is way below the 8000 get requests that are posted here: https://github.com/ranaroussi/yfinance/discussions/1513
Does anybody recognize the bug? Does anybody have a idee how to fix this.
Here are some logs from my bot whenever I got the error:
2023-09-23 **02:00:16,684** - ERROR: DOGE-USD: No price data found, symbol may be delisted (period=1d)
2023-09-26 **02:01:12,335** - ERROR: LINK-USD: No price data found, symbol may be delisted (period=1d)
2023-09-28 **02:00:35,836** - ERROR: LINK-USD: No price data found, symbol may be delisted (period=1d)
2023-09-29 **02:00:37,865** - ERROR: LINK-USD: No price data found, symbol may be delisted (period=1d)
Simple code that reproduces your problem
try:
ticker = yf.Ticker(gvars.yFinSymbol)
data = ticker.history(interval=interval, period=period)
except Exception as e:
lg.error('Something happend while loading yf historical data')
lg.error(e)
sys.exit()
return data
Debug log
2023-09-23 **02:00:16,684** - ERROR: DOGE-USD: No price data found, symbol may be delisted (period=1d)
2023-09-26 **02:01:12,335** - ERROR: LINK-USD: No price data found, symbol may be delisted (period=1d)
2023-09-28 **02:00:35,836** - ERROR: LINK-USD: No price data found, symbol may be delisted (period=1d)
2023-09-29 **02:00:37,865** - ERROR: LINK-USD: No price data found, symbol may be delisted (period=1d)
Bad data proof
No response
yfinance version
Version: 0.2.30
Python version
Python 3.11.4
Operating system
No response
https://github.com/ranaroussi/yfinance/discussions/1669#discussioncomment-6879361
Hi @ValueRaider,
I've tried the 'repair=true' addition to the get history function, I do see some extra logging. But... It still crashes every day at 2.00.
Also the website/graph that I use to see what te market is doing, stops with adding data at 2.00. So it look like this is a yahoo error.
It seems like this is coming from yahoo finance's official API. @ValueRaider can we confirm this?
@rickturner2001, This is what I think. Nothing we can do about it. It's a Yahoo thing. Currently im looking at other data sources cause this is not workable ;) But I still would like to know the solution, cause Yahoo is free :D
Inspect source code and run with debug logging.