45

I read about the YQL, but I didn't understand how can I get some simple data (like company ticker, market cap, stock price, etc.), for ALL COMPANIES?

And an additional question, how can I get all Yahoo Finance tables and theirs fields that can be queried by YQL?

Christophe Roussy
  • 13,732
  • 2
  • 75
  • 75
Ilan
  • 949
  • 2
  • 11
  • 21
  • Can you really use this data commercially ? I am not sure, read: http://meumobi.github.io/stocks%20apis/2016/03/13/get-realtime-stock-quotes-yahoo-finance-api.html – Christophe Roussy Nov 29 '16 at 13:23

4 Answers4

63

To your first question, you can't really do any query through YQL to get data for all companies. It's more oriented towards obtaining data for a smaller query. (I.e., it's not going to give you a full data dump of the whole Yahoo! Finance database.)

To your second question, here's how you can get started exploring the Yahoo! Finance tables in YQL:

  1. Start at the YQL Console
  2. In the upper left corner, make sure Show Community Tables is checked
  3. Type finance in the search field
  4. You'll see all the Yahoo Finance tables (about 15)

Then you can try some example queries like the following:

select * from yahoo.finance.quote where symbol in ("YHOO","AAPL","GOOG","MSFT")

Update 2016-04-04: Here's a current screenshot showing the location of the Show Community Tables checkbox which must be clicked to see these finance tables: enter image description here

BrianC
  • 10,217
  • 2
  • 26
  • 47
  • 6
    Some change in YQL. Checkbox show community tables to the left. – Crocode Nov 10 '13 at 03:40
  • @BrianC : But how do you specify the exchange in that? I mean the stock exchange – Ashwin Aug 04 '14 at 10:46
  • 7
    The only thing I see under `finance` now is `finance.scrape.trend` which does not give access to the market cap, description, etc... – jcalfee314 Sep 01 '14 at 17:10
  • 1
    @Ashwin You can get the stock exchange by querying the yahoo.finance.quoteslist table. Here's a query that I am running and works well: select * from yahoo.finance.quoteslist where symbol in ("^IXIC", "^NYA", ^DJI") &format=json &diagnostic=true &env=store://datatables.org/alltableswithkeys Make sure you also url encode your query url – Laurent Rivard Sep 11 '15 at 14:41
  • Is there a query will help to collect the prices each hour from the previous day? – Udi Feb 02 '16 at 11:37
  • 2
    To make it clear, you need to check the "Show community tables" option on the left sidebar to allow access to the `yahoo.finance.*` tables. – airstrike Apr 04 '16 at 01:43
  • Is there a limit to the number of individual stocks you can request at a single time? – rambossa Apr 05 '16 at 18:00
  • Here's the [info on usage limits.](https://developer.yahoo.com/yql/guide/usage_info_limits.html) Basically its 2000 requests / hour public. 20,000 requests/hour oauth, 100K/day oauth max/day. – zipzit Jun 03 '16 at 15:42
  • Nope. Iv'e just been checking for something else, and the YQL console has now been closed down. All that's left in it's place is a message telling you to bugger off. – shawty Mar 18 '18 at 17:51
  • On top of that, they've also closed down vast majority of the community tables too. – shawty Mar 18 '18 at 17:51
  • Yea, I would assume that for the parts of YQL that aren't dead yet, it will be soon. There's some good discussion in this [Quora thread](https://www.quora.com/Did-Yahoo-Stock-API-shut-down) about alternatives for Finance APIs. – BrianC Mar 19 '18 at 20:39
28

As from the answer from BrianC use the YQL console. But after selecting the "Show Community Tables" go to the bottom of the tables list and expand yahoo where you find plenty of yahoo.finance tables:

Stock Quotes:

  • yahoo.finance.quotes
  • yahoo.finance.historicaldata

Fundamental analysis:

  • yahoo.finance.keystats
  • yahoo.finance.balancesheet
  • yahoo.finance.incomestatement
  • yahoo.finance.analystestimates
  • yahoo.finance.dividendhistory

Technical analysis:

  • yahoo.finance.historicaldata
  • yahoo.finance.quotes
  • yahoo.finance.quant
  • yahoo.finance.option*

General financial information:

  • yahoo.finance.industry
  • yahoo.finance.sectors
  • yahoo.finance.isin
  • yahoo.finance.quoteslist
  • yahoo.finance.xchange

2/Nov/2017: Yahoo finance has apparently killed this API, for more info and alternative resources see https://news.ycombinator.com/item?id=15616880

ronnydw
  • 764
  • 10
  • 22
  • @rdw any idea why running this query fetches nothing really: https://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20yahoo.finance.analystestimate%20WHERE%20symbol%3D'YHOO'&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback= – Ace Green Sep 07 '15 at 04:14
  • 1
    It seems the calls to yahoo.finance.historical and yahoo.finance.dividendhistory are no longer working. Could it be because these tables are not public anymore? – hipokito Jun 03 '17 at 22:40
  • 1
    @hyprfrcb Yahoo finance has killed this API – ronnydw Nov 11 '17 at 10:01
10

Example to recieve it through a request:

a) http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.historical

OR

b) http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes

ssuperczynski
  • 2,473
  • 2
  • 37
  • 57
Roninio
  • 1,613
  • 1
  • 16
  • 23
1

Since Yahoo Finances API was disabled, I found Alpha Vantage API

This a stock query sample that I'm using with Excel's Power Query:

https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=MSFT&interval=15min&outputsize=full&apikey=demo
Zoe
  • 23,712
  • 16
  • 99
  • 132
Victor R. Oliveira
  • 2,434
  • 5
  • 36
  • 66
  • Have a query regarding calling exhange:symbol via alpha vantage The following works https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=NSE:TATAMOTORS&interval=1min&apikey=xxxx works But the following does not work https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=NSE:TATAMOTORS&interval=1min&apikey=xxxx Can you please explain why? – Karan Bhandari Dec 03 '17 at 05:12
  • @KaranBhandari: not sure if it is meant for NSE stocks – rahul.deshmukhpatil Dec 05 '17 at 07:30
  • Make sure you have a valid key. According to your link it doesn't. Register won't take up than a minute. Their documentation is really self explanatory step by step. – Victor R. Oliveira Dec 05 '17 at 08:17
  • Have a valid key, I thought API keys are secret. Did not share. – Karan Bhandari Dec 06 '17 at 01:07
  • Look at the first link - responding for NSE – Karan Bhandari Dec 06 '17 at 01:07