Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_historical_prices not working #47

Open
ifuchs opened this issue May 19, 2017 · 10 comments
Open

get_historical_prices not working #47

ifuchs opened this issue May 19, 2017 · 10 comments

Comments

@ifuchs
Copy link

ifuchs commented May 19, 2017

As of this week, get_historical_prices seems to either timeout or give URL not found responses.
I have tried from several platforms with the same results. Can others reproduce the error? Does anyone know the cause or a solution?

pprint(ystockquote.get_historical_prices('GOOGL', '2013-01-03', '2013-01-08'))
Traceback (most recent call last):
File "", line 1, in
File "//anaconda/lib/python2.7/site-packages/ystockquote.py", line 486, in get_historical_prices
resp = urlopen(req)
File "//anaconda/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "//anaconda/lib/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "//anaconda/lib/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "//anaconda/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "//anaconda/lib/python2.7/urllib2.py", line 1227, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "//anaconda/lib/python2.7/urllib2.py", line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 60] Operation timed out>

@dejafait
Copy link

dejafait commented May 21, 2017

Same thing here @ifuchs
When trying the example on the project page, pprint(ystockquote.get_historical_prices('GOOGL', '2013-01-03', '2013-01-08'))

I get error HTTPError: HTTP Error 504: Maximum Transaction Time Exceeded


Seems like Yahoo Finance API has been shut down,
read more about it there:
https://forums.yahoo.net/t5/Yahoo-Finance-help/Is-Yahoo-Finance-API-broken/td-p/250503
http://stackoverflow.com/questions/44057580/yahoo-finance-api-changes-2017

@cgoldberg any chance you can implement a workaround like this one maybe? would be awesome :)
https://github.com/c0redumb/yahoo_quote_download

@cgoldberg
Copy link
Owner

It looks like Yahoo removed the csv API it was pulling data from. I'm looking for alternative data source

@cgoldberg
Copy link
Owner

Scraping data from the stock quotes page is an option, but their markup is a disaster

@ifuchs
Copy link
Author

ifuchs commented May 30, 2017

If Yahoo historical quotes can't be made to work reliably, this seems to work:

http://trading.cheno.net/wp-content/uploads/2011/12/google.py

@amalek215
Copy link

I have an open pull request that parses their data (grabbing json in source).
Passes the python 2.7 tests but not the 3.x ones
https://github.com/amalek215/ystockquote

@pljanot
Copy link

pljanot commented May 30, 2017

There is still yahoo alternative while using url: "https://query1.finance.yahoo.com/v7/finance/download";
Client requires to have enabled cookies and get crumb. Example query looks like:

https://query1.finance.yahoo.com/v7/finance/download/SBUX?period1=1451602800&period2=1496140683&interval=1d&events=history&crumb=.BprRZODzhT

I used this new endpoint but for some request I get NULL data inside, just let you know. Cheers.

@Cloudberry04
Copy link

For the past year I have been developing a backtesting algo using the historical prices provided by Yahoo finance. Having the API shut down I have nowhere to pull data from. I hope some genius can fix this in the near future or provide an alternative.

@ifuchs
Copy link
Author

ifuchs commented Jun 5, 2017

See my comment above. I have used GoogleQuote to replace Yahoo historical quotes.

@simtaxman
Copy link

The link provided by @ifuchs doesn't seem to work. Is a fix coming or has a better solution been found?

@ifuchs
Copy link
Author

ifuchs commented Sep 21, 2017

I am still seeking a way to get a closing price for a specific date. Does anyone have a working script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants