Search code examples
web-servicesyql

How can I get stock option chains using YQL?


I am trying to get stock option chains from Yahoo using YQL. I have tried this command in the YQL console:

select * from yahoo.finance.options

However, I get this error XML:

<?xml version="1.0" encoding="UTF-8"?>
<error xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:lang="en-US">
    <diagnostics>
        <publiclyCallable>true</publiclyCallable>
    </diagnostics> 
    <description>No definition found for Table yahoo.finance.options</description>
</error>

It looks like this table doesn't exist anymore. Does anyone know what the correct table is?


Solution

  • yahoo.finance.options is a community table. To read about community tables check here. From the link I just posted:

    In order to use YQL with the community tables, you must pass in the datatables env file. You can do this on the YQL console as part of a YQL statement, or by passing in a query parameter.

    The YQL console to test this can be found here