Has yahoo stopped their history data api service?

I used to download yahoo history data everyday with my program until this week. My code is as follows,

URL queryStockUrl = new URL(stockQueryURL);
HttpURLConnection connection = (HttpURLConnection) queryStockUrl
.openConnection();
connection.connect();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(),"utf-8"));

Now the reader can get nothing, no error, no exception thrown. If I enter the same stockQueryURL as above into chrome, I can download the history data file in chrome, but my program can't.

I guess yahoo has stopped the api service, if server finds your history data request is not from a web browser, it will offer you nothing.

Any ideas?
 
You could try it with other programs that use the Yahoo history db. E.g. there are R and Pandas package that do that.
If you're suspicious that they block non-browser access, try changing the user agent.
You seem to use Java, so e.g.:
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)");

or something like that. You can use e.g. http://www.whoishostingthis.com/tools/user-agent/ to find the User-Agent chrome uses on your computer.
Hope that helps.
 
Hi,
Yahoo has changed the protocol to https.
connection.getResponseCode(); will return 301.
Change http to https in your URL and it works.
You should always check the HTTP Response Code.
 
I post the same question on yahoo community today, and someone there told me he met the same problem, I will try to change the http request according to your code.

Thanks
 
Hi,
Yahoo has changed the protocol to https.
connection.getResponseCode(); will return 301.
Change http to https in your URL and it works.
You should always check the HTTP Response Code.

It does work, very helpful, thanks a lot
 
I used to download yahoo history data everyday with my program until this week. My code is as follows,

URL queryStockUrl = new URL(stockQueryURL);
HttpURLConnection connection = (HttpURLConnection) queryStockUrl
.openConnection();
connection.connect();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(),"utf-8"));

Now the reader can get nothing, no error, no exception thrown. If I enter the same stockQueryURL as above into chrome, I can download the history data file in chrome, but my program can't.

I guess yahoo has stopped the api service, if server finds your history data request is not from a web browser, it will offer you nothing.

Any ideas?

Yes. I believe Yahoo finance API is not available anymore. I have moved to MarketXLS after this change, much more reliable data.
 
Back
Top