I've been backtesting a strategy and I continue to get the following problem after my first sell order. I get the following error:
Unable to submit order with id -10 which quantity (0.0901) is less than lot size (0.1).
The order continues to happen even if I use auto position sizing.
Has anyone else had a similar error and/or have found a solution?
Louis Szeto
Hi Jack
Note that the auto position sizing was adjusted by transaction fees (docs). It is recommended to increase the initial cash (you got only 500), or place order with margin
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.
Jack Potzauf
I've upped the Cash amount but I still have the same problem. It will buy and sell, then not trade again. And in the logs it still has the Order Quantity issue. I'm wondering if my order quantity code is wrong or I need to round my order quantity?
I get the following log:
Unable to submit order with id -10 which quantity (0.0208) is less than lot size (0.1).
Derek Melchin
Hi Jack,
The issue arises because the Binance fee model deducts fees from the currency we receive from the trade. In the first trade, the algorithm buys 12179.2 MATIC, which becomes 12167.0208 MATIC after fees. The minimum lot size is 0.1, but the Liquidate method tries to sell 12167.0208 MATIC. See the attached backtest for reference.
To avoid the error, manually round the order quantity.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Jack Potzauf
I apologize if I am asking dumb questions but, to be completely honest with you, I have not idea where I'm supposed to round my order quantity. Do I need to round
quantity = self.CalculateOrderQuantity("MATICUSD", 1)
Or do I need to save at as a new variable and then round that one.
Thank you for your help and your patience.
Derek Melchin
Hi Jack,
We can leave the entry buy order quantity unrounded. We just need to update the sell orders to be
where
With these changes, the algorithm can hold small amounts of MATIC that are smaller than the minimum lot size. Therefore, to ensure the algorithm continues trading, we need to replace
with
See the attached backtest for reference.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Jack Potzauf
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!