pandas DataReader does not import data from yahoo

by: mnalevanko, 6 years ago


Hello,

earlier this week I've noticed that my scripts fail as they cannot get historical data from Yahoo Finance. I don't know if there is a change to Yahoo! Finance API but even the following code from your recent tutorial doesn't work any more.


import datetime as dt
from pandas_datareader import data as web

start = dt.datetime(2000, 1, 1)
end = dt.datetime(2016, 12, 31)

df = web.DataReader('TSLA', 'yahoo', start, end)


Any idea what to do? I used to download historical data for the S&P 500 index ('^GSPC'), but can't figure out if this is possible using 'google' as data_source (instead of 'yahoo').

Thank you very much for your help.



You must be logged in to post. Please login or register an account.



See https://www.elitetrader.com/et/threads/yahoo-historical-data-did-they-change-the-url-recently.309554/

After reading this I have decided to give up on, "python programming for finance" because yahoo appear to have thrown the baby out with the bathwater & vandalised what would have been a fantastic sentdex tutorial

-paddy10tellys 6 years ago

You must be logged in to post. Please login or register an account.


Unfortunately, virtually every single "Python for Finance" tutorial/book/course in the world relied on Yahoo! Finance API that doesn't work anymore. But giving up is not a choice for me.

I agree: the tutorials by sentdex are fantastic. I've learned a lot from them. That's why I would appreciate hearing his thoughts on this.

-mnalevanko 6 years ago

You must be logged in to post. Please login or register an account.


Agree. Correction = I'm giving up for now but will monitor the situation. As a noob programmer (months) I have to pick my learning battles efficiently.

Like you I would appreciate reading his advice...

-paddy10tellys 6 years ago

You must be logged in to post. Please login or register an account.

just try 'google' instead of 'yahoo'. thats it ;)
you wont have 'Adj. Close' but 'Close' to work with

df = web.DataReader('TSLA', 'google', start, end)


-totial 6 years ago

You must be logged in to post. Please login or register an account.


Appreciated! You are most kind :-)

-paddy10tellys 6 years ago

You must be logged in to post. Please login or register an account.

just had a search around and found this http://stackoverflow.com/questions/44012335/python-pandas-datareader-isnt-working
with a comment "

When I visit ichart.finance.yahoo.com right now it shows the message "Yahoo will be right back. Our engineers are working quickly to resolve the issue." So there's clearly a server-side issue right now. Just have a little patience and try again later. "

Which I also get, looks like yahoo has gone poorly for a few days now, or this could be the demise of the api, lets hope not, anyway great tutorials, lets make this a great community as well.

-jasonrobert 6 years ago

You must be logged in to post. Please login or register an account.