During the past 1-2 days, the http query that I used to download historical stock prices from Yahoo Finance has not been working. The link I have been using is the first one below but I have also tried out the other three (since I saw other people using them):
http://real-chart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv
https://real-chart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv
http://ichart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv
https://ichart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv
One interesting thing that I noticed is that the link that the Yahoo website itself provides (to download the data manually) changed. The link used to be the first in the list above (after all, that's where I got it from) but now it is as follows:
https://query1.finance.yahoo.com/v7/finance/download/TRQ?period1=1466805600&period2=1467496800&interval=1d&events=history&crumb=DuX0UxVwtN0
Note that all these links should in theory retrieve the same data: stock prices for TRQ (just an example, I have tried e.g. AAPL as well) from 2016/06/25 to 2016/07/03.
This new links works in the browser or within my program, but it is hardly scalable since it requires a session cookie; if you just leave out the last query parameter, you get an error saying you are not authorized. This question asks about how to create said session cookie in an automated way; however, I want to ask about avoiding this problem entirely by trying to directly access the YQL database.
I tried using the following link to directly use the YQL API (converting the spaces to %20 etc., that's not the problem):
https://query.yahooapis.com/v1/public/yql?q=
select * from yahoo.finance.historicaldata where symbol = "TRQ"
and startDate = "2016-06-25"
and endDate = "2016-07-03"
&format=json
&diagnostics=true
&env=store://datatables.org/alltableswithkeys
&callback=
This link returns a "connection refused" error. As this question suggests, this might be because the datatables.org site is down (the question in the link refers to a downtime incident about a year ago). Does anybody have more information on this?
Thanks.
Yahoo has officially confirmed that the Yahoo Finance API has been discontinued in the following thread in the Yahoo Help Community (see posts by username Nixon):
https://forums.yahoo.net/t5/Yahoo-Finance-help/Is-Yahoo-Finance-API-broken/m-p/250503#U250503
We are all asking ourselves "now what?"
Can Yahoo be persuaded to reinstate the service, possibly at a fee? (see e.g. https://yahoo.uservoice.com/forums/382977-finance/suggestions/19322560-please-bring-back-the-api)
Will a commercial actor step in and provide historical equity and exchange rate data at a reasonable price?
Are there alternative APIs out there that still work?
Please share your findings with the community.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With