If I placed a market order from RESTful API, how do I find out how much the filled price was?
For spot, let’s say place the market order via POST /api/v3/order
, the return json will look something like this:
{
"symbol": "BNBUSDT",
"orderId": 168,
"orderListId": -1,
"clientOrderId": "xxxx",
"transactTime": 1590967624991,
"price": "0.00000000", // original price from client, market order
"origQty": "11.00000000",
"executedQty": "11.00000000",
"cummulativeQuoteQty": "220.00000000",
"status": "FILLED",
"timeInForce": "GTC",
"type": "MARKET",
"side": "BUY",
"fills": [
{
"price": "20.00000000", // filled price
"qty": "1.00000000",
"commission": "0.00000000",
"commissionAsset": "BNB",
"tradeId": 109
},
{
"price": "20.00000000",
"qty": "1.00000000",
"commission": "0.00000000",
"commissionAsset": "BNB",
"tradeId": 110
},
{
"price": "20.00000000",
"qty": "9.00000000",
"commission": "0.00000000",
"commissionAsset": "BNB",
"tradeId": 111
}
]
}
The price in the fills
from response data will give the matched price on each trades. The price may not be the same depending on the time of the fill.
This can also be found via the USER_DATA websocket, in the executionReport
, there is a L
field also returns the filled price.
{
"e": "executionReport",
"E": 1590967624994,
"s": "BNBUSDT",
"c": "2uD5fKxrgPpKxG3kxuuNNu",
"S": "SELL",
"o": "LIMIT",
"f": "GTC",
"q": "10.00000000",
"p": "20.00000000",
"P": "0.00000000",
"F": "1.00000000",
"g": -1,
"C": "",
"x": "TRADE",
"X": "PARTIALLY_FILLED",
"r": "NONE",
"i": 166,
"l": "1.00000000",
"z": "1.00000000",
"L": "20.00000000", // filled price
"n": "0.00000000",
"N": "USDT",
"T": 1590967624991,
"t": 110,
"I": 424,
"w": false,
"m": true,
"M": true,
"O": 1590580465764,
"Z": "20.00000000",
"Y": "20.00000000",
"Q": "0.00000000"
}