- Suppose an Insight object is emitted at time t with a period j, and insights are emitted again at time t+k where k < j. Are current holdings taken into account when creating new orders? For instance,
[Time t] Portfolio Module assigns an optimal weight to AAPL of 0.2
[Time t+k] New insights emitted, Portfolio Module assigns optimal weight to AAPL of 0.3
Will a new order be placed for AAPL to increase total portfolio holdings to 0.3, or will portfolio holdings now total 0.5? I am having issues where number of orders exceeds 10,000 (throwing an error) while total insights are only 1000-1500.
2. Suppose an Insight object is emitted at time t as before, but no other insights are emitted until the insight "expires" (i.e. time t+j). Will the Portfolio Module now automatically liquidate these positions?
Adam W
For anything else curious about this, looking over the LEAN source code suggests that:
1. Default Execution Models (such as ImmediateExecutionModel() ) are sensitive to current holdings, so that only the difference in weights between those suggested from new insights and old insights will be made up for in new orders. This doesn't help figure out why orders are significantly exceeding insights in my case.
2. No positions are automatically liquidated. With relatively frequent emitting of insights, it seems like the Period property can be used to avoid overlaps, but if not, exists mainly as a measure of insight performance as they are "overwritten" by new insights.
Alexandre Catarino
Hi Adam W ,
It's not clear that you are referring to the EqualWeightingPortfolioModel (EWPCM). If so, once the second insight expires, the first will be taken into consideration. Once all insights from a given symbol expired, a zero-quantity portfolio target is created and leads to liquidation.
Also, it will create a portfolio target when the security is removed from the universe and rebalance, in the absence of new insights, according to a given rebalance period (default is one day). On top of the core objective of EWPCM is to set equal weighting, and, consequently, a single insight or insight expiration can trigger the several new targets that will translate into new orders.
I would say that 1000 insights can easily translate into >10000 orders.
Adam W
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!