Hi Everyone,
I am doing the Options Trading Strategies In Python: Basic course. In section 3 there is an iPython notebook that tries to access data from google using the pandas DataReader function .get_data_google()
However the scripted URL is no longer working - does anyone know how to fix this?
Thank you!
The Google finance web reader has recently stopped working. An alternative to fetch the data is to fetch it from Yahoo finance.
A sample code to fetch Apple stock data from yahoo finance is shown below. You need to pip install the fix_yahoo_finance library to run the below code.
import fix_yahoo_finance as yf
import datetime
yf.pdr_override()
# download dataframe
end_date = datetime.datetime.now()
start_date = end_date - datetime.timedelta(days=365)
data = yf.download('AAPL', start_date, end_date)
print data.head()
We have also modified the code in the IPython notebook by creating a wrapper function.
Thank you!
Ishan