import yfinance as yf
d = yf.download(tickers="MSFT", start=start_date, end=end_date)
print("\nData returned with start/end parameters:\n", d, "\n##################")
d = yf.download(tickers="MSFT", period='1wk')
print("\nData returned with 'period' parameters:\n", d, "\n##################")
msft = yf.Ticker("MSFT")
hist = msft.history(period="1wk")
print(f"\nMSFT with '1wk' period is:\n", hist, "\n##################")
hist = msft.history(start=start_date, end=end_date, interval="1d")
print(f"\nMSFT with start/end dates is:\n", hist, "\n##################")
quit()
Debug log
yf.enable_debug_mode() throws an error, since enable_debug_mode is not available on yf.
Bad data proof
[*********************100%***********************] 1 of 1 completed
1 Failed download:
- MSFT: No data found for this date range, symbol may be delisted
Data returned with start/end parameters:
Empty DataFrame
Columns: [Open, High, Low, Close, Adj Close, Volume]
Index: []
##################
[*********************100%***********************] 1 of 1 completed
Data returned with 'period' parameters:
Open High Low Close Adj Close Volume
Date
2024-06-24 00:00:00-04:00 449.799988 452.750000 446.410004 447.670013 447.670013 15913700
2024-06-25 00:00:00-04:00 448.250000 451.420013 446.750000 450.950012 450.950012 16747500
2024-06-26 00:00:00-04:00 449.000000 453.600006 448.190002 452.160004 452.160004 16507000
2024-06-27 00:00:00-04:00 452.179993 456.170013 451.769989 452.850006 452.850006 14806300
2024-06-28 00:00:00-04:00 453.070007 455.380005 446.410004 446.950012 446.950012 28333300
##################
MSFT with '1wk' period is:
Open High Low Close Volume Dividends Stock Splits
Date
2024-06-24 00:00:00-04:00 449.799988 452.750000 446.410004 447.670013 15913700 0.0 0.0
2024-06-25 00:00:00-04:00 448.250000 451.420013 446.750000 450.950012 16747500 0.0 0.0
2024-06-26 00:00:00-04:00 449.000000 453.600006 448.190002 452.160004 16507000 0.0 0.0
2024-06-27 00:00:00-04:00 452.179993 456.170013 451.769989 452.850006 14806300 0.0 0.0
2024-06-28 00:00:00-04:00 453.070007 455.380005 446.410004 446.950012 28333300 0.0 0.0
##################
MSFT: No data found for this date range, symbol may be delisted
MSFT with start/end dates is:
Empty DataFrame
Columns: [Open, High, Low, Close, Adj Close, Volume]
Index: []
##################
Describe bug
The
start
andend
parameters ofdownload
andhistory
methods are no longer returning data, e.g.Passing in the
period
parameter returns data as expected, e.g.gives:
As far as I can tell, the
start
andend
parameters are still valid: https://github.com/ranaroussi/yfinance/blob/main/yfinance/scrapers/history.py.Simple code that reproduces your problem
Debug log
yf.enable_debug_mode()
throws an error, sinceenable_debug_mode
is not available onyf
.Bad data proof
yfinance
version0.2.4
Python version
3.11.4
Operating system
Windows 10