Hi All,
I've noticed this issue before and now that I'm trying to use the framework again I see it again. Using any of the common portolio models (Equal, Confidence, Insight Weighted), whenever I have a short position, it gets rebalanced constantly causing numerious fees. When you have many securities the fees get way out of control because of the excessive trading.
Notice that when the algorithm goes short, we then have consecutive days after where it is rebalancing the short. This is not the behavior I want on short positions, I simply want to hold the position as the long position does. Is there a way to tell the portfolio models to do this or do I have to create my own?
P Chen
Had this issue recently too, check out this thread below:
https://www.quantconnect.com/forum/discussion/7504/want-to-use-insightweighted-portfolio-construction-model-with-rebalancing-disabledNot sure what the C# equivalent is but basically you have two steps to stop daily rebalancings on active Insights:
1) Add these settings in thhe Initialize() method:
self.Settings.RebalancePortfolioOnInsightChanges = False self.Settings.RebalancePortfolioOnSecurityChanges = True
2) Instantiate a portfolio construction model with time param as none
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel(lambda time: None))
Cole S
Thank you this definitely helps me down the path and helps understand the underlying problem. I'm constantly emitting insights that might say [SPY -1] and with long positions this is not a problem. With short positions since it's using margin it varies the position as your unrealized gains go up and down. I guess I'll need to emit insights on change or just write a custom rebalancing function.
Cole S
So even when only emitting the insights when the insight direction is changing the short still rebalances. I'm not sure what's triggering the rebalance since no insights or securities are changing.
Shile Wen
Hi Kctrader,
Automatic rebalancing occurs due to fluctuating prices. To disable rebalancing, as P Chen noted, we pass lambda time: None to the constructor for Python, and the C# equivalent is x=>null. I've shown this in the attached backtest.
Best,
Shile Wen
Cole S
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!