从 Yahoo! 获取调整后的价格信息一次调用多个交易品种的金融 API
我想使用 Yahoo! 获取一组股票代码的调整后价格(调整分割和股息)金融。看起来历史价格调用一次仅限于一个品种。请告诉我是否有一种方法可以在一次调用中获取多个符号?
我想获取这些数据,以便我可以对该数据进行一些回溯测试。由于我可能需要相当多的符号(例如 500-1000 个),因此如果我可以对 Yahoo! 的服务器进行几次批量调用,而不是每天对每个符号进行一次调用,则会更容易。
获取调整价格的另一种方法是使用他们的每日股票价格 API,并使用股息和分割信息手动调整它(他们允许每日股票报价使用多个符号)。不幸的是,我找不到任何方法从 http 调用中获取分割信息(基于 50% 或 200% 的猜测是一种选择,但如果您处理细价股票,这可能很危险,并且无法找出不均匀的分割)。而且,它返回的股息信息也不容易解码。他们似乎返回了4个季度的总额,并且股息日期与基于历史价格的实际股息日期并不真正相符。可以在此处找到呼叫的各种选项:http://www.gummy-stuff。 org/Yahoo-data.htm
对于获取多个交易品种的调整价格有什么建议吗?或者我是否不必要地担心向 Yahoo! 拨打数百个电话?每天?理想情况下,我希望每天在几个小时内下载所有必需的数据 - 即每分钟 10-20 个调用。是不是太多了?我找不到任何有关每秒允许的请求数的文档。
我对其他可以获得类似数据的地方持开放态度。然而,由于我只是想学习量化交易的基础知识而不是交易,所以我更喜欢免费下载。
谢谢 -e
I would like to get the adjusted price (adjusting for splits and dividends) for a group of stock symbols using Yahoo! Finance. It looks like the historical prices call is limited to one symbol at a time. Could please let me know if there is a way to get multiple symbols in one call?
I would like to get this data so I can do some back testing on that data. Since I may require quite a few symbols (say 500-1000), it will be easier if I can make just a few batch calls to Yahoo!'s servers instead of making one call per symbol everyday.
Another way of getting the adjusted price is to use their daily stock price api and adjust it manually using dividend and splits information (they allow multiple symbols for their daily stock quotes). Unfortunately I cannot find any way to get splits information from the http call (guessing based on 50% or 200% is one option but if you deal with penny stocks, this can be dangerous and cannot figure out uneven splits). Also, the dividend information returned by it is not easy to decode. They seem to be returning the total over 4 quarters and the dividend date doesn't really correspond with the actual dividend date based on the historical price. The various options for the call can be found here: http://www.gummy-stuff.org/Yahoo-data.htm
Any suggestions on getting adjusted price for multiple symbols? Or Am I unnecessarily worrying about making 100s of calls to Yahoo! everyday? Ideally I would like to download all the required data within a couple of hours each day - that would be 10-20 calls per minute. Is that too much? I couldn't find any documentation on the permissible number of requests per second.
I am open to other places where I can get similar data. However, since I am just trying to learn the basics of quant trading and not trade, I would prefer free downloads.
Thanks
-e
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个老问题,但我确实找到了可用分割数据的来源。但不确定这些公告有多全面:
http://biz.yahoo.com/c/ 09/s1.html
在 url 中,“09”部分是年份(2009),“s1”部分是月份(s1 = 一月,s2 = 二月,s3 = 三月等) .)
这不是一个干净的 CSV,但页面的格式是一致的并且应该是可解析的。只需每天查询当前月份、解析页面并处理前一天未看到的任何拆分即可。
ETA:还有另一个来源(可能不如雅虎可靠,但可以通过代码查询):
http://getsplithistory.com/
This is an old question, but I did find a source where split data is available. Not sure how comprehensive these announcements are though:
http://biz.yahoo.com/c/09/s1.html
In the url, the "09" part is the year (2009), and the "s1" part is the month (s1 = Jan, s2 = Feb., s3 = Mar., etc.)
It isn't a nice clean CSV, but the format of the page is consistent and should be parseable. Just make a query each day for the current month, parse the page, and process any splits that you didn't see the day before.
ETA: And another source (probably less reliable than Yahoo, but can be queried by ticker):
http://getsplithistory.com/
我不确定你使用的是哪种语言,但我有一个 C# 示例。我认为它至少会给你一个想法,或者可能会对其他人有所帮助。
我们在这里所做的是将“,”附加到每个数组项,然后将该符号列表传递给雅虎。我已在每次调用中成功获取 700 个交易品种的价格。为每个股票代码访问雅虎服务器是一件痛苦的事情。我每天都会获取 6500 多个股票的股票价格。以前需要 3 个小时,现在不到 2 分钟.....
该代码的源代码链接在这里 - http://www.jarloo.com/get-yahoo-finance-api-data-via-yql/
PS 请获取 api key 才能顺利工作。上面的 url 是一个公共链接,其中表大部分时间都会超时。获得 api 密钥后,您的网址将为(减去“public”)
http://query.yahooapis .com/v1/yql
I am not sure which language you are using but I have a sample in C#. I think it will give you the idea at least or may be help some one else
What we are doing here is appending "," to each array item then passing that symbol list to yahoo. I have successfully fetched prices for 700 symbols in each call. Hitting yahoo servers for each ticker is a pain. I fetch stock prices for all of 6500+ tickers everyday. Earlier it use to take 3 hours now it is less than 2 mins.....sweet
Source link for that code is here - http://www.jarloo.com/get-yahoo-finance-api-data-via-yql/
P.S. Please get a api key to work smoothly. The above url is a public link where tables are timed out most of the time. Once you get an api key then your url will be (minus "public")
http://query.yahooapis.com/v1/yql