Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has Yahoo suddenly today terminated its finance download API?

For months I've been using a url like this, from perl:

http://finance.yahoo.com/d/quotes.csv?s=$s&f=ynl1 #returns yield, name, price; 

Today, 11/1/17, it suddenly returns a 999 error.

Is this a glitch, or has Yahoo terminated the service?

I get the error even if I enter the URL directly into a browser as, eg:

http://finance.yahoo.com/d/quotes.csv?s=INTC&f=ynl1 

so it doesn't seem to be a 'crumb' problem.

Note: This is NOT a question which has been answered in the past! It was working yesterday.That it happened on the first of the month is suspicious.

like image 337
user1067305 Avatar asked Nov 01 '17 22:11

user1067305


People also ask

Does Yahoo have an API?

What is the Yahoo Finance 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.

What is API Yahoo?

The Yahoo Mail Web Service API is a full-featured interface to Yahoo! Mail. With it, you can build applications that display message summary information, parse message contents, manage folders, and even compose and send messages. The Web Service uses OAuth for authentication and access to mailbox contents.


2 Answers

Yahoo confirmed that they terminated the service:

It has come to our attention that this service is being used in violation of the Yahoo Terms of Service. As such, the service is being discontinued. For all future markets and equities data research, please refer to finance.yahoo.com .

like image 115
aleg Avatar answered Sep 27 '22 21:09

aleg


As noted in the other answers and elsewhere (e.g. https://stackoverflow.com/questions/47076404/currency-helper-of-yahoo-sorry-unable-to-process-request-at-this-time-erro/47096766#47096766), Yahoo has indeed ceased operation of the Yahoo Finance API. However, as a workaround, you can access a trove of financial information, in JSON format, for a given ticker symbol, by doing a HTTPS GET request to: https://finance.yahoo.com/quote/SYMBOL (e.g. https://finance.yahoo.com/quote/MSFT). If you do a GET request to the above URL, you'll see that the financial data is contained within the response in JSON format. The following python3 script shows how you can parse individual values that you may be interested in:

import requests import json  symbol = 'MSFT' url ='https://finance.yahoo.com/quote/' + symbol resp = requests.get(url)  # parse the section from the html document containing the raw json data that we need # you can write jsonstr to a file, then open the file in a web browser to browse the structure of the json data r = str(resp.content, 'utf-8') i1 = 0 i1 = r.find('root.App.main', i1) i1 = r.find('{', i1) i2 = r.find("\n", i1) i2 = r.rfind(';', i1, i2) jsonstr = r[i1:i2]        # load the raw json data into a python data object data = json.loads(jsonstr)  # pull the values that we are interested in  name = data['context']['dispatcher']['stores']['QuoteSummaryStore']['price']['shortName'] price = data['context']['dispatcher']['stores']['QuoteSummaryStore']['price']['regularMarketPrice']['raw'] change = data['context']['dispatcher']['stores']['QuoteSummaryStore']['price']['regularMarketChange']['raw'] shares_outstanding = data['context']['dispatcher']['stores']['QuoteSummaryStore']['defaultKeyStatistics']['sharesOutstanding']['raw'] market_cap = data['context']['dispatcher']['stores']['QuoteSummaryStore']['summaryDetail']['marketCap']['raw'] trailing_pe = data['context']['dispatcher']['stores']['QuoteSummaryStore']['summaryDetail']['trailingPE']['raw'] earnings_per_share = data['context']['dispatcher']['stores']['QuoteSummaryStore']['defaultKeyStatistics']['trailingEps']['raw'] forward_annual_dividend_rate = data['context']['dispatcher']['stores']['QuoteSummaryStore']['summaryDetail']['dividendRate']['raw'] forward_annual_dividend_yield = data['context']['dispatcher']['stores']['QuoteSummaryStore']['summaryDetail']['dividendYield']['raw']  # print the values print('Symbol:', symbol) print('Name:', name) print('Price:', price) print('Change:', change) print('Shares Outstanding:', shares_outstanding) print('Market Cap:', market_cap) print('Trailing PE:', trailing_pe) print('Earnings Per Share:', earnings_per_share) print('Forward Annual Dividend Rate:', forward_annual_dividend_rate) print('Forward_annual_dividend_yield:', forward_annual_dividend_yield) 
like image 40
mti2935 Avatar answered Sep 27 '22 21:09

mti2935