Search code examples
yahoo-finance

How to get commodity data from yahoo finance?


I am working on a small widget for my projects which basically looks like this. Futures for Yahoo Finance

How can I get the data for Natural Gas, Gasoline, Crude Oil, Heating Oil and their Change?. I want to retrieve those data via json maybe and create a box widget or a ticker. The Image attached is what I am trying to make. Thank you.

enter image description here

PS: I tried CLJ15.NYM Symbol for Crude Oil using yahoo.finance.quotes table in the YQL Console, but it did not work.


Solution

  • You can type the symbol in the same way you would type in a stock. Getting data from Yahoo Finance provides you with a good example of how to use stock symbols with yql.

    For those exact 4, it would look like this:

    select * from yahoo.finance.quote where symbol in ("CLK15.NYM", "HOK15.NYM", "NGK15.NYM", "RBK15.NYM")

    Note: you can use yahoo.finance.quote or yahoo.finance.quotes