(New order) origQty value comes rounded

Hey folks,

When I create a new order (ADAUSDT) to buy 23.68 ADA, the ‘origQty’ field in the response comes rounded as 23.7, and it’s getting me an issue when trying to sell those ADA again because my account balance doesn’t reach that value (-2010 NEW_ORDER_REJECTED).

The ‘q’ field in the executionReport events has the same problem. I’ve checked the ADAUSDT precision and it’s supposed to be 8, but it doesn’t seem to be though.

I’m using nodejs SDK. Thanks in advance!

This is most likely an issue with the third party library. I suggest to review the source code manually or contact the owner of the library.

I’m using the official nodejs SDK GitHub - binance/binance-connector-node: A simple connector to Binance Public API which is referenced from the official Binance docs Binance API Documentation. I’ve already reviewed the source code tho, and there’s no mapping or something else that process the values returned by the API.

Could you please provide logs of the request sent and the response received for us to further diagnose the issue?

Yes sure. This is an order I executed recently:

I bought 30 USDT worth of ADA.

What I see in the Exchange: 22.89060031 ADA

Response from the new order API:

  "symbol": "ADAUSDT",
  "orderId": 2826806603,
  "orderListId": -1,
  "clientOrderId": "xZrj6y3r6go0VGT5ImjCQe",
  "transactTime": 1642282380680,
  "price": "0.00000000",
  "origQty": "22.90000000",
  "executedQty": "22.90000000",
  "cummulativeQuoteQty": "29.97610000",
  "status": "FILLED",
  "timeInForce": "GTC",
  "type": "MARKET",
  "side": "BUY",
  "fills": [
      "price": "1.30900000",
      "qty": "22.90000000",
      "commission": "0.02290000",
      "commissionAsset": "ADA",
      "tradeId": 340890612

Execution report stream received:

  "stream": "xxx",
  "data": {
    "e": "executionReport",
    "E": 1642282380681,
    "s": "ADAUSDT",
    "c": "xZrj6y3r6go0VGT5ImjCQe",
    "S": "BUY",
    "o": "MARKET",
    "f": "GTC",
    "q": "22.90000000",
    "p": "0.00000000",
    "P": "0.00000000",
    "F": "0.00000000",
    "g": -1,
    "C": "",
    "x": "TRADE",
    "X": "FILLED",
    "r": "NONE",
    "i": 2826806603,
    "l": "22.90000000",
    "z": "22.90000000",
    "L": "1.30900000",
    "n": "0.02290000",
    "N": "ADA",
    "T": 1642282380680,
    "t": 340890612,
    "I": 5979285218,
    "w": false,
    "m": false,
    "M": true,
    "O": 1642282380680,
    "Z": "29.97610000",
    "Y": "29.97610000",
    "Q": "30.00000000"

Are you considering the commission fee in your calculations?

Commission fee is either paid in the quote asset of the trade or in BNB if you have BNB burn enabled.

Yes, but even with the commission fee I didn’t find a way to get the 22.89060031 value mentioned before. How could I compute these API values to get the real amount?

Your position should have been 22.9ADA - 0.0229ADA = 22.8771ADA

Did you have a previous position before this trade?

1 Like

You’re right. A small balance of ADA left over from previous trades and the after-trade position + previous position sometimes doesn’t reach the order quantity without commission fees. Thanks a lot for helping!!