How to use YQL to get sectors from Yahoo Finance? - yql

I found out about YQL and would like to use it to get a list of financial sectors. I went to the YQL console and tried to use the yahoo.finance.sectors table:
select * from yahoo.finance.sectors
The results are "null". I'm assuming the data is available. What is wrong with the way I'm calling YQL?

Related

YQL not returning data from balance sheet or income statement

I have been trying to use YQL to access the fundamentals of listed companies. But what is showing up in the Yahoo finance page is not being returned from YQL queries. Specifically I need to retrieve data from balance sheet and income statement, a sample query for Apple in YQL is like:
SELECT * FROM yahoo.finance.balancesheet WHERE symbol='AAPL'
This, however, only returns a time frame (quarterly), and nothing else.
Link to YQL console of my sample query is here
Is the data inaccessible to YQL or is there anything wrong with the way I am running the query? How can I get a complete list of data as in http://finance.yahoo.com/q/bs?s=AAPL through YQL?
Your query used to work fine. However, a month or two ago, a number of yahoo.finance YQL "tables" stopped working.
IOW, you are doing it right, but YQL is broken.
If you mouse over the yahoo.finance.balancesheet entry in the left column of the YQL console, buttons labeled desc and src appear. If you click src, it fetches the scraping code for you: http://www.datatables.org/yahoo/finance/yahoo.finance.balancesheet.xml. To make the E4X JavaScript legible, right-click and select View Source or use wget or curl from the command line.
Notice that the code fetches http://finance.yahoo.com/q/bs?s=AAPL&quarterly and then uses an XPath query to find the data:
var query = y.xpath(rawresult, "//table[#class='yfnc_tabledata1']/tr/td/table/tr");
If you fetch the page into your browser and inspect the HTML, you find that there is indeed a table with class yfnc_tabledata1. However, it has no tr direct child. Apparently, Yahoo must have decided to add a tbody element. That probably explains why the query no longer scrapes any data.
The code page lists Ryan Hoium as the author. A little googling leads to the github repository where the code lives, alongside the code for the other Yahoo Finance tables.
Sadly, only the yahoo.finance.sectors table has received recent attention. The change was to add double slashes to its XPath expression. Double-slashes relax the "direct child" requirement, allowing, for example, tr to still be found even if there is an intervening tbody. However, it appears the new version has not been pushed out to the public site.

Yahoo Query Language (YQL) in iOS

Is it possible to get ALL results in a SELECT statement using the YQL without specifying a where clause.
For example, this block of code will give me stock information for these companies:
SELECT * FROM yahoo.finance.quotes WHERE symbol in ('YHOO','AAPL','GOOG','MSFT')
But, I am wanting an entire list of every single stock in the Yahoo database (something like this)
SELECT * FROM yahoo.finance.quotes
Why is this not working? When I do it in YQL console(https://developer.yahoo.com/yql/console/?q=show%20tables&env=store://datatables.org/alltableswithkeys), it tells me 'Cannot find required keys in where clause; expecting required keys: (symbol)'. Do I always have to use a where clause? If this is the case, then this doesn't seem very useful. If anybody knows a way to get all the stocks without a clause, I'd greatly appreciate some help.

YQL don't provide Indian stock quote related data

we are very interested to use YQL but unfortunately the query is not supported for Indian stock market , we are building one large web app where wee need to show BSE and NSE tickers with live updates , so we thought to use yahoo financial services but I have tried a lot in the console the below line but this is return with zero data
select * from yahoo.finance.quotes where symbol IN("^BSESN")
For that result we can't able to use yql , I have also change the symbol ^BSESN with other Indian company names like reliance ,tata but nothing is shown, feeling very poor......
select * from yahoo.finance.quotes where symbol IN("^BSESN") ---- not working any idea or suggestion will helpful to me
Thanks in advance
Yahoo's YQL shows uneven performance for bourses outside the West. For example:
You can obtain historical data for Reliance Industries from yahoo.finance.historicaldata using YQL as follows: select * from yahoo.finance.historicaldata where symbol in ('RIL.BO')
You cannot get stock quote from yahoo.finance.quotes using YQL as follows: select * from yahoo.finance.quotes where symbol in ("RIL.BO")
Try it!

YQL, returning only 100 values. Can I get more?

I'm using YQL with JSON in order to retrieve a Twitter search. It only returns 100 values. Any chance to get more than that?
Doesn't look good, friend: "The maximum number of results that can be returned by a YQL query on this table is 100, which is defined by the attribute max."
From: http://developer.yahoo.com/yql/guide/yql-tutorials.html
The maximum number of items returned by a SELECT statement with YQL is 5,000. If the table in query does not give enough results by default (assuming there are more available), you can ask for more results by using a remote limit.
select * from twitter.search(250) where q="lol"
For more details, see Paging and Table Limits in the YQL Guide.
Be aware that many data providers will rate limit queries against their services, Twitter certainly does.

how to get results from Yahoo Ireland or Yahoo India search, using YQL

I just want to use YQL to get the top 10 results for a particular query, and a region, eg Yahoo India, or Yahoo Ireland.
How do i do this?
Thanks,
Arvind.
You can use a region value when querying against the search.web table, like
select * from search.web where query="pizza" and region="in"
(Try this query the YQL console.)
Available region values are listed in the Supported Regions and Languages for Web and News Search page for the Yahoo! BOSS API, which the search.web data table uses.
Following changes with the Yahoo Pipes V2 'upgrade' some YQL tables have been dropped.
Thankfully some new ones have appeared but are not widely known about yet.
SELECT * FROM microsoft.bing.web WHERE query="pizza india"

Resources