I dont undertstand the return of CalculateOrderQuantity,
If I have
self.CalculateOrderQuantity(self.asset1, 1)
its return
69777
self.Portfolio.Cash / self.Securities[self.asset1].Price
its return
62699
The values are
self.Portfolio.Cash = 100000
self.Securities[self.asset1].Price = 1.59491
shouldn't it be the same?
Nico Xenox
Hey Juan C.Â
Try to change and adjust your fee model.
CalculateOrderQuantity always adjusts the amount to the fee model you're using. When backtesting your strategies there's always a fee to make your returns more realistic.
Â
Fred Painchaud
Hi Juan,
It also depends on your asset's type. If it is crypto, do not use CalculateOrderQuantity:
Fred
Juan C.
Hi partners,
Thanks for your answers, but the 0 fee model does not solve the problem and I am not using cryptos.
If I use two completely different currencies, the amount returned is very similar between them, and very different from the manual calculation, I attach the backtest with the example
Louis Szeto
Hi Juan
self.Securities[self.asset1].Price would be a price in its quote currency (i.e. AUD in this case), so it would not be accurate when your account currency is in USD, CalculateOrderQuantity/SetHoldings would handle the conversion between the currencies.
Best
Louis
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.
Juan C.
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!