We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
据我所知,最简单的方法是使用雅虎财经 API。这是一个方便的图表,显示了您可以传入的所有选项(阅读整篇文章,因为它已在底部更新):
http://ilmusaham.wordpress.com/tag/stock-yahoo-data/
请注意以下几点:
1)了解之间的区别
未调整和调整后的价格。如果你不小心的话,分裂会让你的比较变得毫无意义。
2)不要忘记合并的影响
和副产品。回到足够远的地方
你几乎肯定是胡说八道。
例如,考虑以下情况
被收购的AT&T消失了
有一段时间,然后这个名字是
复活了。 AT&T 数十年的实际
价格历史记录现在不可用。
The easiest way I know of is with the Yahoo Finance API. Here is a handy chart that shows all the options you can pass in (READ THE WHOLE POST, as it has been updated at the bottom):
http://ilmusaham.wordpress.com/tag/stock-yahoo-data/
Be aware of a few things:
1) Know the difference between
unadjusted and adjusted prices. Splits will make your comparisons meaningless if you aren't careful.
2) Don't forget the effect of mergers
and spin-offs. Go back far enough and
you're almost sure to have nonsense.
For example, think about the case of
AT&T, which was bought, disappeared
for awhile, and then the name was
resurrected. Decades of AT&T's actual
price history is now unavailable.
雅虎财经可以帮助:
例如,对于苹果股票:
http://ichart.yahoo.com/table.csv?s=AAPL&d=11&e=6&f=2009&g=d&a=8& ;b=7&c=1984&ignore=.csv
请求的参数非常简单(s 代表股票代码,f 和 c 代表范围,以年为单位。您可以在以下位置检索数据python 与 urllib 模块,并用 csv 模块解析它们应该很容易,但我可以给你一段代码,如果你把它放在一个 hastable 中,并将键设置为 iso 格式的日期(yyyy-mm)。 -dd),这应该是很容易的一个收盘价,
此外,可以通过 Bloomberg API(Java、C 和 C++)找到最好质量的(商业且非常昂贵的)数据。
yahoo finance can help:
For example, for Apple stock:
http://ichart.yahoo.com/table.csv?s=AAPL&d=11&e=6&f=2009&g=d&a=8&b=7&c=1984&ignore=.csv
The parameters of the request are pretty straightforward (s is for the stock symbol, f and c are for the range, in years. You can retrieve the data in python with the urllib module, and parse them with the csv module. It should be quite easy, but I can give you a piece of code. If you put it in a hastable, with keys set to dates in iso format (yyyy-mm-dd), it should be quite easy one closing price.
Besides, the best quality of (commercial and very expensive) data, can be found with the bloomberg API (Java, C, and C++).
上次我看到,您可以从雅虎获取一系列日期的历史数据,尽管我不知道他们的服务条款中的限制。您可以指定一个相当不错的范围并获取电子表格或 csv 中的数据。我希望你会想要大量缓存它。
Last I looked, you could grab historical data for a range of dates from yahoo, though I don't know the limitations in their TOS. You could specify a pretty decent range and get the data in a spreadsheet or csv. You'd want to cache it heavily, I'd expect.
雅虎财经允许您导出他们的数据。
对于股票行情,左侧边栏有一个指向历史价格的链接。该页面底部有一个链接“下载到电子表格”。
您可以将其传递给 fgetcsv 来解析它。
Yahoo Finance lets you export their data.
For a ticker, on the left sidebar there is a link to Historical Prices. On the bottom of that page there is a link "Download To Spreadsheet".
You could pass that to fgetcsv to parse it.