tags:

views:

68

answers:

2

How can I create a YQL Query that will return me companies from Yahoo Finance?

select * from yahoo.finance.quotes where name like "apple"

Doesn't work.

+1  A: 

That won't work for many reasons. Please try:

select * from html where url="http://finance.yahoo.com/d/quotes.csv?s=AAPL&f=snl1d1t1ohgdr"

To get exactly what you want, you could further filter with xpath in the where clause.

Carnotaurus
do you have any tutorials, or documentation on the finance tables? or on the xpath querying for yql?
Sheehan Alam
There are not many examples around. Here are xpath examples: http://developer.yahoo.com/yql/guide/yql-select-xpath.htmlThis is a list of data field abbreviations: http://search.cpan.org/~edd/Finance-YahooQuote/YahooQuote.pm
Carnotaurus
Please don't forget to vote
Carnotaurus
A: 

Instead of using XPATH I would rather recommend to use the build in CSV datatable and to do something like this:

select * from csv where url='http://finance.yahoo.com/d/quotes.csv?s=AAPL&f=snl1d1t1ohgdr'

The problem with either approach is though that you need to know the stock symbol, so AAPL in this example. So neither my nor the other answer really fulfills your need in terms of being able to search for companies by name.

Don't have more input than this currently, sorry.

sspier