2011-06-22 21 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的數據,並得到了我想要的數據。