add tradeId and time to order fills

Currently, when creating an order, the response can contain fills, however the fills does not contain the field tradeId and time within the fills:

{
  "symbol": "BTCUSDT",
  "orderId": 28,
  "orderListId": -1, 
 ...
  "type": "MARKET",
  "side": "SELL",
  "fills": [
    {
      // Please add "tradeId" and "time" !
      "price": "4000.00000000",
      "qty": "1.00000000",
      "commission": "4.00000000",
      "commissionAsset": "USDT"
    },

Please add tradeId and time within the fills, to avoid the need for an additional call of GET /api/v3/myTrades. Those two properties should be included in any responded trade-record (the orderId can be derived by its parent-order, so there is no need to add orderId within the fills.).

Could you kindly specify which endpoint you are using to create the order?

@tantialex The endpoint is POST /api/v3/order.

The properties tradeId and time are very important facts about a trade and should be always included in any responded trade-record. Please add these two properties in the order response within fills.

tradeId is included in the response, however it is missing in the documentation. This will be amended in the future.

As for trade timestamp, you can use the transactTime property of the order.

@tantialex Are you really sure. I am not talking about GET /api/v3/myTrades which always includes id.

I am talking about the fills-property coming from POST /api/v3/order. I tried it again and I see that id is indeed null, so I assume that it is not sent along the other trade information within fills. Can you look at it? Maybe there is another issue.

I can confirm that $.fills[].tradeId is available for POST https://api.binance.com/api/v3/order.

Could you please provide a sample url and the response received so that we can further diagnose?

Omit sensitive data.

@tantialex is this field called id or tradeId? I get the following response and you can see that fills id is set to 0 (which is wrong):

{
..
    "executedQty":xxx
    "fills": [
        {
            "commission":xxx
            "commissionAsset": "ETH",
            "id": 0,
            "isBestMatch": false,
            "isBuyer": false,
            "isMaker": false,
            "orderId": 0,
            "price": xxx,
            "qty": xxx,
            "time": 0
        }
    ],
    "orderId": xxx,
    "origQty": xxx,
    "price": xxx,
    "side": "BUY",
    "status": "FILLED",
    "symbol": "ETHUSDC",
    "timeInForce": "xxx",
    "transactTime": xxx,
    "type": "LIMIT"
}

@tantialex Do you mean $.fills[].tradeId or $.fills[].id ?

$.fills[].tradeId

Could you please define the url used to obtain the response above, and the library you are using to connect to the API?

I use java “xchange binance api” and “binance java api”. But both, defines id instead of tradeId and requests id instead of tradeId.

@tantialex Can you please submit a response from your own so I can see the right responded property names (e.g. tradeId instead of id)?

{
  "symbol": "BNBUSDT",
  "orderId": 3621851162,
  "orderListId": -1,
  "clientOrderId": "XfHajRhw8MDtdafi1X8jxi",
  "transactTime": 1643363776896,
  "price": "0.00000000",
  "origQty": "0.10000000",
  "executedQty": "0.10000000",
  "cummulativeQuoteQty": "38.45000000",
  "status": "FILLED",
  "timeInForce": "GTC",
  "type": "MARKET",
  "side": "SELL",
  "fills": [
    {
      "price": "384.50000000",
      "qty": "0.10000000",
      "commission": "0.00007501",
      "commissionAsset": "BNB",
      "tradeId": 510209803
    }
  ]
}

The above is the schema of the /api/v3/order response. Your issue seems to be with the third-party library, I suggest contacting the owner to better diagnose the issue.

1 Like

@tantialex Is there any documentation where I find the whole json responses for /api/v3/? The binance-spot-api-docs/rest-api.md at master · binance/binance-spot-api-docs · GitHub does not show all json responded properties…

The below is correct, with an amendment to come for the tradeId.

Ok, thanks. One minor note: As most 3rd party libs use the same response type for order.fills and /api/v3/myTrades, it would be reasonable to rename tradeId to id because /api/v3/myTrades calls it also id and not tradeId:

[
  {
    "symbol": "BNBBTC",
     // api/v3/myTrades uses "id" and not "tradeId"
    "id": 28457,
    "orderId": 100234,
    "orderListId": -1,
    "price": "4.00000100",
    "qty": "12.00000000",
    "quoteQty": "48.000012",
    "commission": "10.10000000",
    "commissionAsset": "BNB",
    "time": 1499865549590,
    "isBuyer": true,
    "isMaker": false,
    "isBestMatch": true
  }
]
1 Like

While this is a bad assumption which should not be made by third-parties, we will consider it in a future iteration. Thanks for bringing it to our attention.