How far back in time can I query historical quotes from Yahoo Finance YQL?

你说的曾经没有我的故事 提交于 2019-12-11 13:48:11

问题


I'm building a small proof-of-concept app that requires historical stock quotes. The UI in my app allows users to select a date range, and I've been using the YQL console to generate the REST calls to request the historical quote data. YQL calls like this:

select * from yahoo.finance.historicaldata where symbol = "JNJ" and startDate = "2015-01-01" and endDate = "2015-12-11"

work fine, but if I go too far back into time like this:

select * from yahoo.finance.historicaldata where symbol = "JNJ" and startDate = "2013-01-01" and endDate = "2015-12-11"

I get no quotes back and find a warning in the XML that looks like this:

<warning>Too many instructions executed: 50223882</warning>

How far back in time can we query before running into the limit?


回答1:


It appears that the limit for at least a single ticker quote is 364 records. I found this out by doing several YQL queries and finding that this query works:

select * from yahoo.finance.historicaldata where symbol = "JNJ" and startDate = "2014-07-03" and endDate = "2015-12-11"

and this one doesn't:

select * from yahoo.finance.historicaldata where symbol = "JNJ" and startDate = "2014-07-02" and endDate = "2015-12-11"

When I parse the XML coming back from the first query, I find 364 records.



来源:https://stackoverflow.com/questions/34233174/how-far-back-in-time-can-i-query-historical-quotes-from-yahoo-finance-yql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!