I've been trying to understand the algorithm framework and tested the attached code with the most basic parts:
- ManualUniverseSelection consisting of only one SPY security
- ConstantAlphaModel to emit a long signal
- EqualWeightingPortfolioConstructionModel
- ImmediateExecutionModel
- NullRiskManagementModel
What I'm expecting from the backtest is one buy order at the start. However, there seems to be an extra order created a few days after the first order is filled. May I understand which module is creating this extra order?
Jared Broad
Thank you for posting the code this is a fascinating case. January 3rd is a Saturday, so the buy order was a market on open for Monday morning for N-stocks. However, by Monday morning (6th) the price had moved significantly resulting in the order being too heavy so the equal weighting portfolio construction downscaled it by 7-shares.
You can see this "fixed" by selecting Minute resolution data which allows the fill intraday and fills at an accurate price. From there the algorithm does not need further rebalancing.
self.UniverseSettings.Resolution = Resolution.Minute symbols = [ Symbol.Create("SPY", SecurityType.Equity, Market.USA) ] self.SetUniverseSelection( ManualUniverseSelectionModel(symbols) )
Â
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.
Malcolm Tok
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!