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.