Getting data from Yahoo Finance [closed]
Asked Answered
M

4

46

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?

Memorialize answered 10/2, 2013 at 7:36 Comment(1)
Can you really use this data commercially ? I am not sure, read: meumobi.github.io/stocks%20apis/2016/03/13/…Balikpapan
K
64

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

Klement answered 19/2, 2013 at 4:58 Comment(11)
Some change in YQL. Checkbox show community tables to the left.Habilitate
@Klement : But how do you specify the exchange in that? I mean the stock exchangeBorodino
The only thing I see under finance now is finance.scrape.trend which does not give access to the market cap, description, etc...Counsellor
@Borodino 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 urlShote
Is there a query will help to collect the prices each hour from the previous day?Hesper
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.Riorsson
Is there a limit to the number of individual stocks you can request at a single time?Repel
Here's the info on usage limits. Basically its 2000 requests / hour public. 20,000 requests/hour oauth, 100K/day oauth max/day.Superordinate
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.Tormentil
On top of that, they've also closed down vast majority of the community tables too.Tormentil
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 about alternatives for Finance APIs.Klement
C
29

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

Claus answered 26/12, 2014 at 11:12 Comment(3)
@rdw any idea why running this query fetches nothing really: 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=Carrier
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?Gammon
@hyprfrcb Yahoo finance has killed this APIClaus
B
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
Bathetic answered 14/11, 2017 at 19:41 Comment(5)
Have a query regarding calling exhange:symbol via alpha vantage The following works alphavantage.co/… works But the following does not work alphavantage.co/… Can you please explain why?Yoga
@KaranBhandari: not sure if it is meant for NSE stocksMoradabad
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.Bathetic
Have a valid key, I thought API keys are secret. Did not share.Yoga
Look at the first link - responding for NSEYoga

© 2022 - 2024 — McMap. All rights reserved.