I'm getting an empty dataframe for my downloads. I've looked for other who've had this problem, but must be searching incorrectly or I'm the only one. I upgraded to latest version of yfinance (and verified), plus cleared my yfinance cache.
Simple code that reproduces your problem
import yfinance as yf
spy = yf.Ticker('SPY')
spy.history(period='1mo')
Failed to get ticker 'SPY' reason: HTTPSConnectionPool(host='fc.yahoo.com', port=443): Max retries exceeded with url: / (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000209144B4650>: Failed to resolve 'fc.yahoo.com' ([Errno 11001] getaddrinfo failed)"))
$SPY: possibly delisted; no price data found (period=1mo)
Empty DataFrame
Columns: [Open, High, Low, Close, Adj Close, Volume]
Index: []
Describe bug
I'm getting an empty dataframe for my downloads. I've looked for other who've had this problem, but must be searching incorrectly or I'm the only one. I upgraded to latest version of yfinance (and verified), plus cleared my yfinance cache.
Simple code that reproduces your problem
import yfinance as yf spy = yf.Ticker('SPY') spy.history(period='1mo')
same result with MSFT
Debug log
DEBUG Entering history() DEBUG Entering _fetch_ticker_tz() DEBUG Entering get() DEBUG Entering _make_request() DEBUG url=https://query2.finance.yahoo.com/v8/finance/chart/SPY DEBUG params=frozendict.frozendict({'range': '1d', 'interval': '1d'}) DEBUG Entering _get_cookie_and_crumb() DEBUG cookie_mode = 'basic' DEBUG Entering _get_cookie_and_crumb_basic()
Bad data proof
Failed to get ticker 'SPY' reason: HTTPSConnectionPool(host='fc.yahoo.com', port=443): Max retries exceeded with url: / (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000209144B4650>: Failed to resolve 'fc.yahoo.com' ([Errno 11001] getaddrinfo failed)")) $SPY: possibly delisted; no price data found (period=1mo) Empty DataFrame Columns: [Open, High, Low, Close, Adj Close, Volume] Index: []
yfinance
version0.2.48
Python version
3.12
Operating system
Windows 11