The quantity is 0 while the cash holdings are above 0, how I can fix this?
QUANTCONNECT COMMUNITY
The quantity is 0 while the cash holdings are above 0, how I can fix this?
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.
Fred Painchaud
Hi Eduardo,
Just a simple assumption: did you verify that quantity is really 0 and not a very small value close to 0 but not 0?
For instance, it looks like you have 0.0018 USDT worth of BTC. That points towards a very very small amount of BTC… like 4.4e-8 or so.
For crypto, you need to manage quantity using the Cashbook. Maybe that's something you did not do so you end up not exiting your positions completely?
Fred
Eduardo Barros Verez
Hi, I started using a version 1.0 of my algo in live and it made some orders correctly. Those 0,0018 are BTCUSDT if you look at the simbol in the right side it shows the BTC symbol same as ETH and XRP (although I have 0 XRP). Later I put version 2.0 in live with those orders of version 1.0 already closed, so the algo correctly views the cash/quantity of what the version 1.0 have made but it doesnt reconize it as algorithm holdings. My question is: Will this afect in the future when I want to sell with this formula: if self.Portfolio[symbol].Quantity > 0 ? or what about this one: Â self.MarketOrder(symbol, -(self.Portfolio[symbol].Quantity ) ?
Eduardo Barros Verez
Hi, so I fixed it by just redeploying in version 1.0 the code of version 2.0. Watch what I said in the previous comment:Â
Fred Painchaud
Hi Eduardo,
Glad you solved your problem.
Side note: Crypto does not trade as equities in QC. Refer to
You must not use self.Portfolio[symbol].Quantity but the CashBook. So you need to use, to determine the amount of BTC you hold, for instance, self.Portfolio.CashBook["BTC"].Amount.
Fred
Eduardo Barros Verez
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!