I've made an algorithm for my local stock exchange (Oslo, Norway). As QC doesn't offer data for these stocks, my algo is downloading the data from Yahoo Finance and adding them using the AddData function:
for ticker in tickers:
symbol = self.AddData(Yahoo, ticker, Resolution.Daily).Symbol
history = self.History(symbol, 200, Resolution.Daily)
stock = StockData(symbol, history, 75, 100)
self.stocks[symbol] = stock
"tickers" is just a list of tickers, and "StockData" is an object that stores info about moving averages, rate of change and stuff like that. Yahoo is the function that downloads the data from Yahoo Finance.
This is all working well and the backtests are running fine until the list of tickers exceeds 100. With more than 100 tickers, the backtests are still running without errors, but any ticker exceeding what seems to be a limit of 100, are ignored.
Is there a limit to the number of custom data objects that can be added to the algorithm? Or any other limitation in Lean that causes this behavior? If so, is there a way to work around this?
Derek Melchin
Hi Christian,
Consider downloading all of the data from Yahoo Finance ahead of time and saving it to Dropbox.
The Download method is rate-limited. We have an open GitHub Issue to have this information added to the documentation. Track our progress here.
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Christian Piene Gundersen
Hi Derek.
Thanks for your reply. I will try the dropbox approach. But I doubt this is a rate-limit issue. It rather seems like a number limit. I've tried downloading (directly) from different sources, and the algo never receives more than 100 symbols. It always stops at excactly 100 - never 99 or 101. I find that to be a peculiar number. 128, 512 or 4096 would be understandable, but 100 is just strange. Is there an explanation for this limit?
Derek Melchin
Hi Christian,
The 100 limit is a known limitation. See this related thread.
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Christian Piene Gundersen
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!