Back

Trouble with Implementing Margin us Insight Weighted Portfolio Construction

I am trying to implement Margin using the AlgorithmFramework, and in particular InsightWeightedPortfolioConstruction.  

This is proving difficult as the above does not allow the sum of all weights to total > 1.0.

Is there a "cleaner" way to implement margin than modifying the InsightWeightedPortfolioConstructionModel?

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.


Hi Mark,

The sum of the insight weights we emit to the InsightWeightedPortfolioConstructionModel can be greater than 1, the PCM normalizes the weights by this sum in that case. View the source code here.

The cleanest way to implement margin is to  inherit from InsightWeightingPortfolioConstructionModel
and override CreateTargets

class MyPCM(InsightWeightingPortfolioConstructionModel):
leverage = 0.5

def CreateTargets(self, algorithm, insights):
targets = super().CreateTargets(algorithm, insights)
return [PortfolioTarget(x.Symbol, x.Quantity*(1+self.leverage)) for x in targets]

See the attached backtest for a full example of this.

Best,
Derek Melchin

4

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