获取股票的价格历史

时间:2010-07-31 21:38:17

标签: http stocks

是否有任何简单的HTTP API可以让我在特定日期和时间获得符号(例如GOOG)的股票价格?

像...一样的东西。

http://somewebsite.com/?
    symbol=GOOG&
    year=2010&
    month=7&
    day=30&
    hour=4&
    minute=00

回复$ 484.85

我希望得到一个haskell函数的最终结果,其类型签名看起来像......

getQuote :: Symbol -> Date -> Time -> Price

4 个答案:

答案 0 :(得分:11)

我相信拥有雅虎财务的YQL可以完成这项任务,他们的数据可以追溯到1996年查看一些股票。

http://www.yqlblog.net/blog/2009/06/02/getting-stock-information-with-yql-and-open-data-tables/

http://www.gummy-stuff.org/Yahoo-data.htm

答案 1 :(得分:1)

以下是example有关如何使用YQL通过Yahoo Finance API从2014-01-01到2015-01-01从Apple股票(AAPL)获取JSON格式的数据。

YQL查询是URL编码的:

select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%3D%22AAPL%22%20and%20startDate%3D%222014-01-01%22%20and%20endDate%3D%222015-01-01%22

所以,如果你解码它,你就会得到:

select * from yahoo.finance.historicaldata where symbol="AAPL" and startDate="2014-01-01" and endDate="2015-01-01"

只需将日期值更改为您想要的值,然后将整个内容解码回来,例如使用此网址编码器:http://meyerweb.com/eric/tools/dencoder/

然后,通过将编码查询添加到请求URL中将整个事物放在一起:

http://query.yahooapis.com/v1/public/yql?q={ENTER_QUERY_HERE}&env=http://datatables.org/alltables.env&format=json

所以,你最终得到这样的东西:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%3D%22AAPL%22%20and%20startDate%3D%222014-01-01%22%20and%20endDate%3D%222015-01-01%22&env=http://datatables.org/alltables.env&format=json

这会在您设置的时间段内为您返回一些精美的JSON格式数据。

答案 2 :(得分:0)

http://www.mergent.com/servius查看历史证券数据API - 我认为它们不会有日内数据......

答案 3 :(得分:0)

您可以在http://www.myinvestorshub.com/historic_intraday_data.php(适用于所有国家/地区)找到历史日内数据

相关问题