How far back in time can I query historical quotes

2019-08-11 05:02发布

问题:

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.