Contango
Contango

Reputation: 80382

Any .NET examples for Yahoo Query Language (YQL)?

I'd like to make some simple calls to Yahoo Query Language (YQL). Has anyone implemented this in .NET?

Here is the query I'd like to make from .NET:

select MarketCapitalization 
from yahoo.finance.quotes 
where symbol 
  in ("YHOO","AAPL","GOOG","MSFT","unknown")

Update

Everything is working 100%, thanks @fernaramburu.

Upvotes: 12

Views: 12068

Answers (4)

fernaramburu
fernaramburu

Reputation: 148

Yes. There two good examples that are actually working because I just tested some hours ago...

http://jarloo.com/get-yahoo-finance-api-data-via-yql/

and

http://jarloo.com/code/get-historical-stock-data/

Hope this help! It helps me a lot!

Upvotes: 8

Maas
Maas

Reputation: 381

Not really an example, but a complete .NET library is Yahoo! Finance Managed.

A description for using the lib can you find here.

Upvotes: 6

Contango
Contango

Reputation: 80382

There is a complete example (with downloadable .NET source code) here:

http://andy.edinborough.org/C-OAuth-Implementation/

This example implements OAuth to let you take advantage of the higher usage limit of 100,000 requests / day and 10,000 requests / hour.

To create an OAuth key, see So, you want to use some Yahoo! APIs.

The code won't work without a minor change: replace the query for pizza with "show tables".

Update:

YQL didn't work with without appending the following string to the query:

&env=http%3A%2F%2Fdatatables.org%2Falltables.env

The full query string is:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20%28%22MSFT%22%29&diagnostics=true&env=http%3A%2F%2Fdatatables.org%2Falltables.env

To obtain a full query URL from a YQL query:

  • Browse to the Yahoo YQL query console.
  • Create a query, e.g. select * from yahoo.finance.quotes where symbol in ("MSFT")
  • On the base of the page, there is a section under "The Rest Query". Copy this. This URL will work in any browser (or any desktop app that uses YQL).
  • Modify the C# source to append the string &env=http%3A%2F%2Fdatatables.org%2Falltables.env to the url within the two overloaded QueryYahoo functions.

Upvotes: 3

ba__friend
ba__friend

Reputation: 5913

To access the YQL Web Service, a Web application can call HTTP GET, passing the YQL statement as a URL parameter...

Then WebRequest would be your friend. You can find tons of information how to make GET calls to a webservice on the net.

Or are you talking about a LINQ-Provider?

Upvotes: 3

Related Questions