2011-06-22 25 views
6

我正在使用YQL检索金融期权数据。例如:使用YQL获取金融期权数据

select * from yahoo.finance.options where symbol="AAPL" and expiration="2011-07" 

但是,上述查询返回的数据为optionsChain

有没有办法只检索特定选项符号的记录,例如: symbol=AAPL110716C00155000

谢谢你的时间。

回答

5

除了“远程过滤器”(symbolexpiration)之外,您可以对从yahoo.finance.options带回的结果集应用“本地过滤器”作为所需符号。

select option 
from yahoo.finance.options 
where symbol = "AAPL" 
    and expiration = "2011-07" 
    and option.symbol = "AAPL110716C00155000" 

Try this query in the YQL console.

有关过滤查询结果的更多信息请参阅YQL文档中的Filtering Query Results (WHERE)页。

+0

非常匹配!!!它工作正常:) –

+0

截至今天它似乎并没有工作了。 –

+0

YQL似乎有问题。另一个尝试是Google也有一个选项API。我有一个教程,如果有人正在寻找替代品:http://www.jarloo.com/google-stock-options-api/ – Kelly

0

我刚刚得到的所有数据的optionsChain通过:

select * from yahoo.finance.options where symbol="A" and expiration="2012-10" 

而且,当时只是使用JSON解析器解析optionsChain的数据,并得到了我想要的数据。