雅虎财经有数据请求上限吗?有替代方案或解决方法吗?
你好呀 我已扫描此网站和 Google,以获取有关从雅虎财经下载股票信息的最新更新。我没有取得太大的成功。当我测试我的应用程序时,我使用以下 C# 代码片段遇到了 404 服务器未找到异常:
string urlTemplate =
@"http://ichart.finance.yahoo.com/table.csv?s=[symbol]&a=" +
"[startMonth]&b=[startDay]&c=[startYear]&d=[endMonth]&e=" +
"[endDay]&f=[endYear]&g=d&ignore=.csv";
...
WebClient wc = new WebClient();
try
{
history = wc.DownloadString(urlTemplate);
}
您知道雅虎最近(或总是)是否有关于您可以从雅虎财经服务器请求多少金额的更新吗?如果是这样,有人知道上限或阈值吗?是超过时间还是每日请求的最大数量?我考虑过随机提出一个最多 2 分钟的睡眠请求来解决这个问题。我认为这没有帮助。有没有其他方法可以让我不断向雅虎财经提出请求?我认为雅虎有某种订阅服务,你可以用它来达到这个目的。我找不到任何相关信息。如果这些都不是雅虎的禁忌,那么有人有任何负担得起的替代服务或数据馈送服务的建议吗?
Hi there
I have scanned this site and Google for any latest updates on downloading stock info from Yahoo Finance. I have not had much success. As I am testing my app, I came across an 404 server not found exception using the following C# code snippet:
string urlTemplate =
@"http://ichart.finance.yahoo.com/table.csv?s=[symbol]&a=" +
"[startMonth]&b=[startDay]&c=[startYear]&d=[endMonth]&e=" +
"[endDay]&f=[endYear]&g=d&ignore=.csv";
...
WebClient wc = new WebClient();
try
{
history = wc.DownloadString(urlTemplate);
}
Do you know if Yahoo recently (or always) had some update on how much much you can request from Yahoo's Finance server? If so, does anyone know the upper limit or threshold? Is it over time or max number of daily requests? I thought about putting a random sleep request of up to 2 minutes to get by this. I don't think that would help. Is there any alternatives that would enable me to constantly make requests to Yahoo Finance? I thought Yahoo had some kind of subscription service you could use for this exact purpose. I cannot find anything about it. If none of this is a no go with Yahoo, does anyone have any recommendations of affordable alternative services or data feed services?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅Yahoo 查询语言使用信息和限制页。这适用于所有 YQL API,而不仅仅是财务 API。
YQL 速率限制:
这意味着:
每个 IP 每小时 2,000 个请求(或每天最多总共 48,000 个请求)。
每个 IP 每小时 20,000 个请求,每个 API 密钥每天不得超过 100,000 个请求。
至于实施,如果你想使用雅虎财经API,那么你必须遵守他们的要求。构建一个仅发出允许的请求数量的系统,以防止错误。您可以使用数据库来执行此操作(如果有多个脚本/应用程序客户端使用它),并使用线程/作业(作业=轮询)来等待,直到它可以发出更多请求。获取API 密钥来扩展您的限制。获取多个 API 密钥以进一步扩展它。
至于替代方案,更是数不胜数。我只使用过 Yahoo 和 Google API。雅虎是我的首选,但我还没有找到可比的免费替代品。试试你的运气,如果找到了请告诉我!
See the Yahoo Query Language Usage Information and Limits page. This is for all of the YQL APIs, not just the Finance API.
YQL Rate Limits:
What this means:
2,000 requests per hour per IP (or up to a total of 48,000 requests a day).
20,000 requests per hour per IP and you are limited to 100,000 requests per day per API Key.
As for implementation, if you wish to use the Yahoo Finance API, then you must adhere to their requirement. Build a system that only makes the number of requests they allow to prevent errors. You can do this with a database (in case there is more than one script/application client using it) and use threads/jobs (jobs=polling) to wait until it can make more requests. Get an API key to extend your limit. Get multiple API keys to extend it even more.
As for an alternative, there are too many to count. I've only used the Yahoo and Google APIs. Yahoo is my preferred option, but I haven't found a free alternative that is comparable. Try your luck and let me know if you find one!
他们从来没有说过限制是什么。我曾经每天更新大约 6000 只股票,它很有效。在其他一些页面上,限制似乎要高得多,但在历史股价上,它们确实会在某些时候被阻止。
顺便说一句,有时雅虎服务器会返回未记录的 HTTP 999 代码,我将其解释为“请求太多”。
如果您想要的只是日终数据,那么也许您可以尝试以下操作:
http://www.eoddata.com/products/default.aspx
(我自己从来没有尝试过)
当然对于更频繁的数据有付费订阅。
They never said what the limit was. I used to update something like 6000 stocks daily, it worked. On some other pages the limit seems to be much higher, but on historic stock prices they do block at some point.
By the way, sometimes yahoo server returns undocumented HTTP 999 code which I interpret as "too many requests".
If all you want is end of day data then perhaps you can try this:
http://www.eoddata.com/products/default.aspx
(I've never tried it myself)
Of course there are paid subscriptions for more frequent data.