Price/quantity estimation vs executed Market order

Hello,

My question might be stupid but I’m trying to understand the quantity/values I got in my order response message.
I have implemented a small java code that get the latest BNB/BUSD ticker price and then issue an order to just buy BNB with 50 BUSD.

Here are my logs:

TickerPrice[symbol=BNBBUSD,price=547.00000000]

NewOrder
[symbol=BNBBUSD,
side=BUY,
type=MARKET,
timeInForce=,
quantity=0.09140768,
quoteOrderQty=50.0,
price=,
newClientOrderId=,
stopPrice=,
stopLimitPrice=,
icebergQty=,
newOrderRespType=FULL,
recvWindow=50000,
timestamp=1640462613811]

NewOrderResponse
[symbol=BNBBUSD,
orderId=1064271601,
clientOrderId=XXX,
transactTime=1640462613512,
price=0.00000000,
origQty=0.09100000,
executedQty=0.09100000,
status=FILLED,
timeInForce=GTC,
type=MARKET,
side=BUY,
fills=Trade[id=130077798,
symbol=,
price=547.10000000,
qty=0.09100000,
quoteQty=,
commission=0.00006825,
commissionAsset=BNB,
time=0,
buyer=false,
maker=false,
bestMatch=false,
orderId=]]

Estimated BNB quantity = 0.09140767824497258
Executed BNB quantity = 0.091

So as part of my estimation I want to buy 0.09140767824497258 of BNB at 547 BNB/BUSD with 50 BUSD
So in the worse case let say BNB/BUSD price climb to 547,1 at the moment I issue the order then I would expect 50/547,1 = 0,0913909705721075 BNB in the Response but I only get qty=0.09100000

I would be happy if someone could tell where I’m wrong with this simple Market Order?

Thanks :slight_smile:

  • Not sure how you didn’t receive error when posting new order with parameter “quantity” and “quoteOrderQty”, because only one of them can be used. Check the 2nd table in Binance API DocumentationMARKET | quantity or quoteOrderQty.
    If useful, more details with Beginner's Guide to QuoteOrderQty Market Orders.

  • When using API, one needs to be aware of the Filters section in the API Doc (Binance API Documentation). The “stepSize” for BNBBUSD is “0.00100000”, which mean when you place order with quantity=0.09140768, you should have received error msg "Filter failure: LOT_SIZE".

Based on above, your order should have thrown errors, so not sure how you were able to get 0.09100000 in the response, but the decimals can be explained with the “stepSize”

1 Like

Thanks for your answer.
I think if you provide both quantity AND quoteOrderQty is will only use the second one. The reason why I’m trying with quoteOrderQty is because I always get a LOT_SIZE error when I try with quantity and I was not able to fix it for now even with checks on Min and Max quantity for the given pair:

    if (qToEvaluate >= Double.parseDouble(filter.getMinQty()) && qToEvaluate < Double.parseDouble(filter.getMaxQty())

You answer about the stepSize is very interesting ! I will have a look :slight_smile:

Many thanks for your quick answer.

PS: To give a bit of context I’m currently trying to implement a piece of code able to build a full list of Triplet candidates based on all valid pairs of binance and check if there are opportunities to perform basic arbitrage (it takes fees in account). But for that I need to reconciliate estimation and real executed orders.

Sample of my logs:

[(BNB,BUSD), (WIN,BNB), (WIN,BUSD)]
TickerPrice[symbol=BNBBUSD,price=547.00000000]
TickerPrice[symbol=WINBNB,price=0.00000092]
TickerPrice[symbol=WINBUSD,price=0.00050810]
Quantity of BUSD= 50.0
Quantity of BNB with 50.0 BUSD = 0.09133912248628885
Quantity of WIN with 0.09133912248628885 BNB sold using WINBNB = 99207.19363524362
Quantity of BUSD with 99207.19363524362 WIN sold using WINBUSD = 50.369369704752735
[Action] Can perform arbitrage !
Quantity of BUSD = 50.369369704752735