Search code examples
apiyahoofinance

YQL - Yahoo Finance API : Retrieve option list


In this post : Alternative to google finance api, AuRa shows us that we can retrieve a list of all currencies with an URL like this :

http://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote

Is there a similar way to retrieve a list of all options on a particular market, like all warrants from NYSE Euronext for example ?

I also tried YQL (Yahoo Query Language) with requests formed as follow :

SELECT * FROM yahoo.finance.quotes WHERE symbol matches '.*CAC*.'

or

SELECT * FROM yahoo.finance.quotes WHERE symbol like 'CAC%'

Both returned a :

[...] description : 'matches|like' is not a supported operator for input key 'symbol'. 
The only valid operator for keys is '='

I tried this on quote, quotes, quoteslist or options tables with the same result.

Do I miss something ? How could I retrieve a list of all warrants/options based on CAC40 ?

Thank you


Solution

  • There is no a community table that fetches the components of a certain symbol.

    Instead, you can create your own query so you can fetch the data from the tables of Yahoo Finance, directly.

    For example, the next query extracts the data from the table located at the URL where components of CAC40 are described.

    SELECT * FROM html WHERE url='https://uk.finance.yahoo.com/q/cp?s=%5EFCHI' AND xpath='//table/*[contains(.,"Symbol")]//b//a'
    

    However, as you can see from the URL, these tables are limited to 50 elements per page, so you can only fetch a maximum of 50 elements per query, and complete your fetch by performing a query per page. For symbols with less than 50 components this solution works fine.