YQL:从yahoo.finance.quotes返回单个字段



我刚刚开始使用 YQL,遇到了以下问题:我不能让 YQL 从 yahoo.finance.quotes 表中返回单个值。

我只想在"引号"中选择"打开"标签

这是我正在使用的查询:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%20=%20%22AAPL%22%20and%20startDate%20=%20%222015-01-1%22%20and%20endDate%20=%20%222015-01-2%22&format=xml&diagnostics=true&env=store://datatables.org/alltableswithkeys

执行查询

我试图在官方文档中找到解决方案,但它确实按照他们解释的方式工作。文档

任何帮助都非常感谢!

提前谢谢你!

只需指定选择"Open"标签而不是选择所有标签(使用星号(*)表示您需要所有标签)。所以这个查询:

select Open 
from yahoo.finance.historicaldata 
where symbol = "AAPL" 
      and startDate = "2015-01-1" 
      and endDate = "2015-01-2"

..然后转换为以下网址:

http://query.yahooapis.com/v1/public/yql?q=select%20Open%20from%20yahoo.finance.historicaldata%20where%20symbol%20=%20%22AAPL%22%20and%20startDate%20=%20%222015-01-1%22%20and%20endDate%20=%20%222015-01-2%22&format=xml&diagnostics=true&env=store://datatables.org/alltableswithkeys

..应该完全按照你想做的事。

最新更新