2015-04-07 127 views
1

我已在deevloper.yahoo.com和yql控制台https://developer.yahoo.com/yql/console上创建并使用API​​。如何获取雅虎财经股票数据?

勾选显示社区表和搜索财务。

我得到了股票数据的结果。在这里我得到了josn和xml格式历史数据的确切数据。

链接为历史数据yahoo.finance.historicaldata。

像我得到的所有数据

http://finance.yahoo.com/q/hp?s=AAPL+Historical+Prices和对这种股票休息查询

yql?q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%20%3D%20%22YHOO%22%20and%20startDate%20%3D%20%222009-09-11%22%20and%20endDate%20%3D%20%222010-03-10%22&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback= 

当我尝试其他股票,如yahoo.finance.balancesheet等股票

我看到了我在url中发送的参数错误,特别是在其他股票期权条件下

任何人都可以告诉什么是确切的网址fo r其他股票期权。

回答

0

你似乎要的是:

https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.historicaldata where symbol = "YHOO" and startDate = "2009-09-11" and endDate = "2010-03-10"&format=json&diagnostics=true&env=store://datatables.org/alltableswithkeys&callback= 

您可以养活这个URL,例如wget,它将返回JSON的斑点。

我从哪里得到该URL?我开始YQL Console与Show Community Tables检查。接下来,我输入了您的查询(上面的q参数)并收到了有效的JSON。最后,我走到页面的底部,它以绿色表示“REST QUERY”,并将该URL从框中复制出来。