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.

Liquid Value Stocks

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

 

Author