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.
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.
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.
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.
Finance.yahoo.com is UP and reachable by us.
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.
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