Back

Rebalancing Monthly using PortfolioConstructionModel? - Algorithm Framework

Hi There,

I've found other forum posts describing how to use SetHoldings for rebalancing a portfolio on a given date, weekly, monthly, etc. However, I am having trouble finding an example using the Algorithm Framework, only executing trades/rebalancing on a monthly basis when implementing a custom PortfolioConstructionModel. Do I need to keep track of the timespan somehow in my main algorithm file in Initialize()? Is there someway to add this logic to the PortfolioConstructionModel itself? Thank you!

Update Backtest







0

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.


The PortfolioConstructionModel is meant to receive Insight objects from the alpha model and create PortfolioTargets. If the algorithm needs to trade/rebalance on a monthly basis, try emitting insights once a month and then the PortfolioConstructionModel will create the targets/rebalance on a monthly basis. One possibility could be using a boolean that stops any trading decisions from being made and change the boolean to True once a month,

0

What triggers the Update method in Alpha Model? And why isn't it possible to user-define the frequency with which it is called? 

0

Hi Filib,

The Update method gets called as frequently as the smallest resolution data in your Universe (i.e. Hour, Minute, etc.). You can force it to ignore data slices and only run the code within at certain times, and I've added an example of this to your post here.

0

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.


Jack Simonson Could you please post your code/backtest here?

0

Hello Grimreaper,

Thanks for your support! You could find Jack's code and backtest, the accepted answer, in this link by clicking buttons of the chart, statistics, and code  

If there's a problem, please let me know. Hope it helps!

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed