ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
14.89k stars 2.44k forks source link

Getting empty DataFrame from data download #2104

Closed jpkern0 closed 3 weeks ago

jpkern0 commented 3 weeks ago

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 version

0.2.48

Python version

3.12

Operating system

Windows 11

ValueRaider commented 3 weeks ago

Search here for fc.yahoo.com