Back

SetHoldings doesn't create order

Hi everyone,

I'm developing a strat where I do Coarse and Fine universe selection, the algo runs without error, takes quite a long time to finishes running but produces 0 trade.

While debugging, I could confirm that the universe selection works (OnSecuritiesChanged triggered with new securities), that onData is triggered and SetHoldings is also called but OnOrderEvent is never called.

I'm quite lost now since there's 0 error produced and can't understand what's happening.

Thanks !

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.


Hey - this could be that you're doing an integer division of 1 / 10 which ends up being 0.

Change the line to 

self.SetHoldings(symbol, 1.0/self.MAX_INVESTED_SYMBOLS)

and it should work.

In my personal opinion this is one of many great reasons to avoid Python for any application outside of school assignments, but I know a lot of people will disagree with me...

0

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