I tried a small example to buy/sell crypto using binance. The buy works fine:

xrp = self.AddCrypto(self.ticker1_1, Resolution.Daily, Market.Binance).Symbol

quantity = self.CalculateOrderQuantity(xrp, *)

self.Buy(xrp, quantity)

  • New Order Event: Time: 01/18/2022 23:00:00 OrderID: 1 EventID: 2 Symbol: XRPBUSD Status: Filled Quantity: 215 FillQuantity: 215 FillPrice: 0.7572 OrderFee: 0.215 XRP Message: Binance Order Event Buy


but when I wanted to sell using :  self.Liquidate() I get the following error:

  • Order Error: id: 2, Insufficient buying power to complete order (Value:-159.1451), Reason: Your portfolio holds 214.785 XRP, 0 XRP of which are reserved for open orders, but your Sell order is for 215 XRP. Cash Modeling trading does not permit short holdings so ensure you only sell what you have, including any additional open orders.


Looks like Binance takes  the fee from that 215 xrp and remains 214.785 xrp. My problem is why quant is not aware of this and try to sell 215. And how could I solve it…