Back

Facing problems with EqualWeightingPortfolioConstructionModel

Hello All,

 

I am trying to execute EqualWeightingPortfolioConstructionModel but somehow none of the stocks are purchased and I am not sure why.

After my fine selection, I get 40 stocks to purchase but no actual purchase happens.

Can you please help me here? 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.


Hi Ray,

To get the algorithm trading, we just need to add an alpha model and an execution model.

self.AddAlpha(ConstantAlphaModel(InsightType.Price, InsightDirection.Up, timedelta(1)))
self.SetExecution(ImmediateExecutionModel())

Additionally, to ensure the algorithm starts trading right away, we should set the `current` property to be at least 30 days before the current time in Initialize.

self.current = self.Time - timedelta(31)

We should also change the guards in the universe selection to return `Universe.Unchanged` instead of an empty list.

if (self.Time - self.current).days <= 30:
return Universe.Unchanged

See the attached backtest for reference. Also, consider reviewing our documentation on the Algorithm Framework.

Best,
Derek Melchin

1

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