Hi there
I can make short tradings by "self.SetHoldings()" on quant connect cloud but failed on local lean with this error: "Unable to compute order quantity of ETHUSDT. Reason: The cash model does not allow shorting. Returning null."
how shall I do the same on local lean as quant connect cloud?
Fred Painchaud
Hi Frank,
This is usually due to:
1- Lack of setting your brokerage with self.SetBrokerageModel().
2- Lack of setting leverage with SetLeverage() on the Security object returned by AddCrypto(). Many put 3.3 as leverage.
3- You should not use SetHoldings with crypto as it does not handle the cashbook accurately (it was designed for equities). You should compute order quantity using the CashBook.
Check out this thread - it might help.
Fred
P.S. I'm surprised it worked in the cloud however if you are not doing the above.
South_wind
Hi Fred
Thanks for your reply;
I have modify my code as you advice as below, but still can't run well; Is there still something wrong?
Fred Painchaud
Hi Frank/South wind,
Here are some modifs:
So, just modifs to what you've done. I don't know exactly which of the problems you wanted to solve ("but still can't run well") but I hope it helps.
Fred
Frank cao
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!