One week ago, I ran the following code and did not get an error.
import datetime as dt
import pandas_datareader.yahoo.daily as yd
df1 = yd.YahooDailyReader("SPY", interval='d', start=dt.date(2022,7,1),end=dt.date.today()).read()
However, when I tried the same code today, I got the following error message:
Does anyone know how to solve this problem?
CodePudding user response:
It seems yahoo finance has changed it API or the service is down.
You can use Tiingo API instead (you need to make an account to get an API token)
import pandas_datareader as web
r = web.get_data_tiingo("SPY", api_key=ENV('NEWS_TOKEN'))
see: Remote Data Access#Tiingo
CodePudding user response:
I have the same problem, yfinance is still working
import yfinance as yf
from yahoofinancials import YahooFinancials
my_data = yf.download('TSLA', start='2021-12-17', end='2022-12-17', progress=False)