Hi,
I am using the WeightingPortfolioConstructionModel(rebalance = timedelta(hours=1)) PCM and I noticed after the first open/close exchange, the rebalancing function sell and buy small amounts of a single assest. I am sending renewing insights in the same direction. In the case below, I am sending Long insights (Direction.Up) every hour for a duration of one hour for HES and the Portfolio is selling and buying small amount of HES. HES is the only holding. Why is this happening? How are negative targets being generated, even though the insights are long? Is it possible to limit these orders?
Thank you,
Keith
Derek Melchin
Hi Keith,
The small orders are a result of the portfolio rebalancing to maintain a leverage of 1. To stop this from occurring, we need to redefine the `rebalancing` function of the PCM
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel(lambda time: None))
and increase the duration of our insights. See the attached backtest for reference.
Best,
Derek Melchin
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.
Keith Forward
Hi Derek,
Thank you for your help. I have update my code. My algo calculations price targets and stoplosses for each entry. In my alpha model, I determine when a price taget or stoploss is hit and exit the position. Sometime this before the entry insight has expired. To exit the position, I send an flat insight with the expiration time after the entry insight. However, an entry order is created after both insights have expired. How is this possible?
Derek Melchin
Hi Keith,
Please attach a backtest that reproduces the issue so we can assist with further debugging.
Best,
Derek Melchin
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.
Keith Forward
Hi Derek,
Thank you. Here is any example. A flat insight is emitted at 2021-02-02 and the initial position is closed. The next insight is on 2021-02-05, but orders are placed on 2021-02-03 without an insight,
Thank you,
Keith
Keith Forward
Hi Derek,
In this case, there are not insights emitted but a trade is executived. I thought a position is only opened when an insight is emitted. Is this a rebalace problem?
Thanks,
Keith
Keith Forward
Please disregard the backtest above with TSLA (it told a moment for the insight to display), please consider the backtest with HES.
Derek Melchin
Hi Keith,
To resolve the issue in this backtest, we just need to change the period on the flat insights from
symbolData.bull_insight_exp - data.Time
to
symbolData.bull_insight_exp
See the attached backtest for reference.
Best,
Derek Melchin
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.
Keith Forward
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!