Has Yahoo finance web service disappeared? API changed? Down temporarily?

K Markey picture K Markey · Jul 13, 2016 · Viewed 78.1k times · Source

For quite some time I've been using the following REST API to query Yahoo finance for current prices. It is documented in several Stack Overflow posts, e.g. Yahoo finance webservice and elsewhere in .

http://finance.yahoo.com/webservice/v1/symbols/$SYMBOLS/quote?format=json

where $SYMBOLS is a comma-delimited list of stock or index symbols.

Yesterday the query stopped working, returning only a "Moved Temporarily. Redirecting to ..." message.

Is this web service now closed? Has it been replaced by YQL or another API? Queries for a table of historic prices to "ichart" still work. E.g.,

http://ichart.finance.yahoo.com/table.csv?d=2&e=3&f=2016&g=d&a=0&b=1&c=2011&ignore=.csv&s=$SYMBOL

Thanks.

Answer

Hemant Prasad picture Hemant Prasad · Jul 15, 2016

I was facing a similar issue from last 2-3 days. The url works on the smartphone, where on the desktop it gives "Not a valid parameter" error and HTTP Code 406.

This can be resolved by adding user agent as "Mozilla/5.0 (Linux; Android 6.0.1; MotoG3 Build/MPI24.107-55) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36" while invoking the get request.

For example, if you are downloading from curl in php use as follows:

curl_setopt($session,CURLOPT_USERAGENT,"Mozilla/5.0 (Linux; Android 6.0.1; MotoG3 Build/MPI24.107-55) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36");

I hope this will resolve the issue.