我正在尝试使用YQL从Yahoo Finance检索选项数据。非常奇怪的问题是,我可以为其他符号下载所需的选项数据,例如AAPL(Apple)和MSFT(Microsoft),但不适用于GOOG(Google)。
这是我的查询和结果。显然,我可以检索AAPL和MSFT的数据,但很遗憾。这不仅发生在yahoo.finance.option_contracts上,还发生在所有其他与选项相关的表中,包括yahoo.finance.options。我很确定这不是与查询限制有关的事情,因为下面显示的查询预计只能检索不到10个结果。
select * from yahoo.finance.option_contracts where symbol in ( 'GOOG', 'AAPL', 'MSFT')
{
"query": {
"count": 2,
"created": "2014-03-03T15:00:45Z",
"lang": "en-US",
"diagnostics": {
"url": [
{
"execution-start-time": "0",
"execution-stop-time": "1",
"execution-time": "1",
"content": "http://www.datatables.org/yahoo/finance/yahoo.finance.option_contracts.xml"
},
{
"execution-start-time": "4",
"execution-stop-time": "1057",
"execution-time": "1053",
"content": "http://finance.yahoo.com/q/op?s=MSFT"
},
{
"execution-start-time": "5",
"execution-stop-time": "3571",
"execution-time": "3566",
"content": "http://finance.yahoo.com/q/op?s=AAPL"
},
{
"error": "Connect Failure",
"execution-start-time": "5",
"execution-stop-time": "10017",
"execution-time": "10012",
"content": "http://finance.yahoo.com/q/op?s=GOOG"
},
{
"error": "Connect Failure",
"execution-start-time": "5",
"execution-stop-time": "10017",
"execution-time": "10012",
"content": "http://finance.yahoo.com/q/op?s=GOOG"
}
],
"publiclyCallable": "true",
"javascript": [
{
"execution-start-time": "3",
"execution-stop-time": "1074",
"execution-time": "1070",
"instructions-used": "18571",
"table-name": "yahoo.finance.option_contracts"
},
{
"execution-start-time": "3",
"execution-stop-time": "3616",
"execution-time": "3612",
"instructions-used": "31142",
"table-name": "yahoo.finance.option_contracts"
},
"Exception: Read timed out, url: http://finance.yahoo.com/q/op?s=GOOG",
{
"execution-start-time": "3",
"execution-stop-time": "10017",
"execution-time": "10013",
"instructions-used": "31142",
"table-name": "yahoo.finance.option_contracts"
}
],
"user-time": "10018",
"service-time": "19447",
"build-version": "0.2.2157"
},
"results": {
"option": [
{
"symbol": "AAPL",
"contract": [
"2014-03",
"2014-04",
"2014-05",
"2014-06",
"2014-07",
"2014-10",
"2015-01",
"2016-01"
]
},
{
"symbol": "MSFT",
"contract": [
"2014-03",
"2014-04",
"2014-05",
"2014-06",
"2014-07",
"2014-10",
"2015-01",
"2016-01"
]
}
]
}
}
}
总之,每当我尝试检索GOOG的期权数据时,我只会得到“读取超时”错误的空结果。对于其他选项符号,例如AAPL和MSFT,我得到了我想要的东西。
任何人都知道为什么会这样?
答案 0 :(得分:1)
这必须与谷歌公司在 TWO 贴纸下交易(见http://finance.yahoo.com/news/google-trades-under-2-tickers-225300863.html):GOOG和GOOGL。
YQL不承认GOOG,但会接受新的代码 GOOGL 。我怀疑YQL查询错误出乎意料地得到两个代码而不是一个寻找只是一个。
如果您在Yahoo!Finance上请求Google报价,则可以。