Test running this algo live, I got a few different errors that I am afraid of. the most important being:
Order Error: id: 24, Insufficient buying power to complete order (Value:-990.6537), Reason: Your portfolio holds 0.02715147 BTC, 0 BTC of which are reserved for open orders, but your Sell order is for 0.02715269 BTC. Cash Modeling trading does not permit short holdings so ensure you only sell what you have, including any additional open orders.
it was trying to sell all btc and buy eth, but it was trying to sell more than my account actually had. this is either a bug or impropper use of self.SetHoldings() in the algo. Either way, the only way I can think to mitigate this is to have a 1% cash buffer, but that still wouldn't work I don't think. I tried this through the self.Settings.FreePortfolioValuePercetage() function to no avail. back test is attatched, maybe you guys can edit my code to make it less buggy. All help is appreciated! Thank you!
Louis Szeto
Hi Joshua
Resolution you use is daily, it has high slippage in reality so your portfolio worth might already be less than the time the order was made (so order could be 101% of your value for example). Also, the order amount is made according to the slice's last price, which might not be the same as the ask/bid price that also cause slippage problem. If your account does not have margin, then better to use minute resolution or lower resolution to obtain more accurate ask/bid and leave a buffer. Also, you might consider using spread execution model.
Cheers
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.
Varad Kabade
Hi Joshua Hughes,
The issue with invalid orders is related to using SetHoldings to place orders. Refer to this thread for more information. We recommend referring to the following algorithm, which shows how to place orders for multiple crypto assets.
Best,
Varad Kabade
Joshua Hughes
Varad, once again, you are the man. Your'e extremely helpful. Thank you so much.
Joshua Hughes
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!