Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 yahoo-finance.

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.

like image 927
K Markey Avatar asked Jul 13 '16 14:07

K Markey


People also ask

What happened to Yahoo Finance API?

Strangely, after the launch of a new feature in Yahoo's API it was decided that discontinuation would occur. Yes, that means there is no more reliable way to gain access to stock information freely, and users have to purchase this data on yearly/monthly subscriptions.

Does Yahoo Finance still have an API?

The Yahoo Finance API is a RESTful API that provides access to financial data. This data includes stock quotes, historical prices, and company information. The API is free to use and does not require an API key. The Yahoo Finance API is available in both JSON and XML format.

Is Yahoo Finance deprecated?

Yahoo deprecated their Finance API in 2017. So you can see many websites talking about alternatives for Yahoo Finance API. However, the python library yfinance offers a temporary fix to the problem by scraping the data from Yahoo! Finance and returning the data in the DataFrame format.

Is Yahoo Finance offline?

Finance.yahoo.com is UP and reachable by us.


1 Answers

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.

like image 103
Hemant Prasad Avatar answered Sep 21 '22 11:09

Hemant Prasad