获取股票的价格历史记录

发布于 2024-09-12 11:15:07 字数 375 浏览 5 评论 0原文

是否有任何简单的 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

Are there any simple HTTP APIs out there which will let me get the stock price for a symbol (such as GOOG) at a specific date and time?

Something like...

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

Giving a response of $484.85

I'm hoping to have an end result of a haskell function whose type signature looks something like...

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

失去的东西太少 2024-09-19 11:15:07

我相信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

I believe YQL with Yahoo finance can complete this task, they have data going back to 1996 looking on some stocks.

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

无法言说的痛 2024-09-19 11:15:07

这是 示例说明如何使用 YQL 通过雅虎财经 API 获取 2014 年 1 月 1 日至 2015 年 1 月 1 日期间 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"

只需将日期值更改为您想要的值并将整个内容解码回来,例如使用此 URL 编码器: 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 格式的数据。

Here is an example on how to get the data in JSON-format from 2014-01-01 to 2015-01-01 for Apple stock (AAPL) via Yahoo Finance API using YQL.

The YQL query is URL-encoded:

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

So, if you decode it, you'll get:

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

Just change the date values to ones you want and decode the whole thing back, for example using this URL-encoder: http://meyerweb.com/eric/tools/dencoder/

Then, put the whole thing together by adding the encoded query into the request URL:

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

So, you end up with something like this:

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

Which will return you some fine JSON-formated data for the time period you've set.

梦忆晨望 2024-09-19 11:15:07

查看历史证券数据 API,网址为 http://www.mergent.com/servius - I不过,我认为他们不会有日内数据......

Take a look at the Historical Securities Data API at http://www.mergent.com/servius - I don't think they'll have intraday data though...

乱了心跳 2024-09-19 11:15:07

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

You can find historic intraday data at http://www.myinvestorshub.com/historic_intraday_data.php ( for all countries)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文