Do we need to setup below code of the warmup, startdate and enddate for the live deployment?
self.SetStartDate(2024, 6, 20)
self.SetEndDate(2024, 8, 2)
self.SetCash(self.portfolio_risk.market_value)
self.SetWarmUp(timedelta(days=5))
Don't have an account? Join QuantConnect Today
QuantConnect Community Discussions
QUANTCONNECT COMMUNITY
LEAN is the open-source algorithmic trading engine powering QuantConnect. Founded in 2012 LEAN has been built by a global community of 180+ engineers and powers more than 300+ hedge funds today.
Join QuantConnect's Discord server for real-time support, where a vibrant community of traders and developers awaits to help you with any of your QuantConnect needs.
The Open-Quant League is a quarterly competition between universities and investment clubs for the best-performing strategy. The previous quarter's code is open-sourced, and competitors must adapt to survive.
Warmup is crucial for live deployment to prepare indicators and ensure accuracy.
Continue ReadingRefer to our Research Guidelines for high quality research posts.
Create an account on QuantConnect for the latest community delivered to your inbox.
Sign Up Today
|
|
|||||||
|
|
||||||||
|
Warmup is needed for Live deployment ?
Dharmesh Khalasi | August 2024
Do we need to setup below code of the warmup, startdate and enddate for the live deployment?
self.SetStartDate(2024, 6, 20)
self.SetEndDate(2024, 8, 2)
self.SetCash(self.portfolio_risk.market_value)
self.SetWarmUp(timedelta(days=5))
Very relevant question, Gabriel Moncarz. I was trying to do something similar for my In & Out algo and needed to save certain information, for instance, when the algo exits the market so that this action is not ‘forgotten’ when live trading crashes.
For an implementation highlighting the relevant lines in the algo, see here.
Or for an implementation in a somewhat tighter/less complex algo code, see here.
All the best.
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.
QuantConnectâ„¢ 2025. All Rights Reserved
Mia Alissi
In live trading, the
SetStartDate
,SetEndDate
, andSetCash
methods are ignored. These methods are typically used for backtesting to define the date range and initial cash for the backtest.The
SetWarmUp
method is used to warm up your algorithm and its indicators for trading. It simulates winding back the clock from the time you deploy the algorithm. In a backtest, this is theStartDate
of your algorithm. In live trading, it's the current date.So, for live trading, you don't need to set the start date, end date, and cash. However, you may want to keep the
SetWarmUp
method if you need to warm up your indicators or other parts of your algorithm.Here is how you can set up the warm-up period in your algorithm:
This will wind back time 5 days from the start of your algorithm.
Sources:
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.
Dharmesh Khalasi
I am using Resolution of Second for all my stocks so during the live deployment , SetWarmUp(timedelta(days=50)) takes forever and timeout and got timed out so I removed the of the SetWarmUp. So Resolution is Second, so how does setWarmUp for 50days get data ? Does it get data for each seconds for 50days ?
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.
Dharmesh Khalasi
Indeed ,I need daily data for the indicator so I can use Daily Resolution for the WarmUp and for trading , I can use Second Resolution.
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.
Mia Alissi
Yes, you can certainly do that. You can use the
SetWarmUp
method with a daily resolution to warm up your indicators, and then use second resolution data for your trading decisions.Here's how you can set a warm-up period with a specific resolution:
This will warm up your algorithm with 50 days of daily data, regardless of the resolution of your data subscriptions.
Then, in your
initialize_buyable_assets
method, you can subscribe to second resolution data for your securities:This way, your algorithm will use second resolution data for trading decisions, but your indicators will be warmed up with daily data.
Sources:
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!