Back

[Feature] History and Warmup

Hey all!

I'm here to publicly announce a feature that we've all been waiting for, history and warmup! With these new features you can request historical data from any point in the algorithm. You can also specify a warm up period where we'll pump historical data through the algorithm to get it into a ready state. This is great for live trading when you have some indicators that may take weeks, months, or even years to reach a ready state. Now that same algorithm can be ready to start trading within minutes of deploying!

Here's a link to all the History and Warmup API methods on the base algorithm class.

Have a look at the simple history demo algorithm I put together for you guys. Feel free to ask questions!
Update Backtest






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.



Can someone explain to me why this version of CoarseSelect does not load the data for a month delay. I realize it is because the history for the sma_small is defined at 30 days. But I thought that if I placed the history function inside a class that gets fetched by the CoarseSelectionFunction this would permit the warmup to occur prior to launching the first period's data.. I tried to emulate Stephen c# function above but obviously missed something.

 

Appreciate any input.

0


Hi Serge,

i only took a look for 5 minutes.... could you please point the direction or mark the codeline with an X where the problem occurs. THE HISTORY method you created does not get called that is why i dont understand what does not work to warm up. :) :)

take a look at this example. its a more advanced class for the new framework algo but it warms up indicators when a security is new maybe it helps

Line: 126  symbolData.WarmUpIndicators(history.loc[ticker])

 

https://github.com/QuantConnect/Lean/blob/871e99d9960ed25a1db40a0c9469f2f246c8a638/Algorithm.Framework/Portfolio/MeanVarianceOptimizationPortfolioConstructionModel.py
0

Michael,

 

You of course are right there is no History call. My final algo will have a History  called to populate some of the SymbolData attributes, but I did not include it in this sample framework. What confused me in this sample algo is that my universe gets populated with qualifying values once 30 days have passed, corresponding to my 30 day sma functionality. 

I was not sure why. I first thought the sma indicator was doing some kind of magic and spitting out 30 days of results when I fed its "Update" method today's time and price values, EVEN IF IT HAD NOT RECEIVED 30 DAYS OF PRIOR DATA POINTS.. Obviously that cannot be. So I guess the Update method is  failing or returning an empty set - so the returned variable  is evaluating to False until such time as i have passed 30 days of data, and then it returns true. The code link you have sent to me is very useful, and I think I'll be able to get it to work. Essentially, every time the Universe is changed (OnSecuritiesChanged) and a new Security is detected that is not in our SymbolData dictionary, I should first register thei indicator within the main algorithm instance (calling SymbolData's RegisterIndicators function) then run a history search appropriate to the indicator , and pass that to the DataSymbol's WarmupIndicators function, which updates the indicator values for each row of the history tuple you pass it .Did I get that right?If I misunderstood let me know. Otherwise I will try to get this to work and will post the finished code here to pay it forward.Thanks
 
 
0

Hi all, 

I'm confused. Could someone explain how one can retrieve the specific price, say, 10 minutes before the current price?

Thanks a million!

0

For further questions on the "History and Warmup" feature, please check out the docs:
 

https://www.quantconnect.com/docs/algorithm-reference/historical-data
0

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.


Update Backtest





0

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.


Loading...

This discussion is closed