I decided to set fees to zero in my algorithm, and to my surprise, it changed the number of trades and insights that my algorithm made. In the attached backtest, you can see that there are 90 total trades with 101 insights. Now comment out line 21
# self.SetSecurityInitializer(lambda x: x.SetFeeModel(CustomFeeModel()))
and run the backtest again. Now the algorithm has made 102 total trades with 102 insights.
Is there any reason why setting fees to zero would change the total trades and insights that an algorithm would make? Also, why does setting fees to zero make my trades and insights diverge, but with fees the trades and insights are the same?
Shile Wen
Hi Victor,
The reason the number of trades are different is because the first security initializer (setting raw prices) is overridden by the second security initializer. To address this, we need to combine the two security initializers into one function. I've shown this in the attached backtest.
Best,
Shile Wen
Victor Lin
Hi Shile,
I think you forgot to attach your backtest, but I was able to figure it out using your great explanation.
Thanks,
Victor
Victor Lin
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!