Hello,
I need your advice on how to properly liquidate positions within the Alpha Model.
Let's take the Liquid Value Stocks example from the QC bootcamp.
This example shows how the algorithm emits insights for long and short positions each month. Unfortunately, there is no part of the code that would show how to liquidate positions in the portfolio that no longer meet the conditions of the universe selection process.
In fact, I have to say I'm a little confused.
I know from the documentation that insights are emitted using the Update function. However, changes in the composition of the universe are addressed by the OnSecuritiesChanged function. So, if I had to use the insight.flat parameter to liquidate a position, what should the code look like? Or is there another solution?
Thank you
Shile Wen
Hi Daniel,
Liquidating stocks removed from the Universe is the job of the PortfolioConstructionModel, e.g. EqualWeightingPortfolioConstructionModel, which liquidates securities removed from the universe. Furthermore, the EWPCM sends a 0-quantity target when an Insight expires, so Flat insights only need to be returned for securities with active insights.
Best,
Shile Wen
Daniel Jurnik
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!