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))
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 ?
Mia Alissi
The
SetWarmUp
method in QuantConnect is used to initialize your algorithm with historical data. When you set a warm-up period of 50 days with a resolution of seconds, the algorithm tries to load and process every second of data for the past 50 days for each of your securities. This can be a very large amount of data and can cause the algorithm to take a long time to start or even time out.If you're using a high-resolution data like seconds, it's recommended to use a smaller warm-up period or use a lower resolution for the warm-up period. For example, you could warm up with minute or hour resolution data instead.
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.
However, if you're using indicators that require second resolution data, warming up with daily data might not be sufficient. In this case, you might need to manually warm up your indicators or use a different approach.
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
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.
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.
Dharmesh Khalasi
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!