Getting 4015 Error on orders

I am sending multiple orders to Binance fapi/v1/batchOrders

Most orders are going through correctly, However, Sometimes I will receive an error on a single order.

Here is an example, I sent 5 orders, 4 came back fine and confirmed. One came back with this

image

I don’t understand why I am receiving a client ID error when I am not sending a client ID.
The orders sent before it, In the same message, were fine, and also the ones after it. They were all generated using the same piece of formatting code.

This is the sent order

Here you can see, First order sent, Then headers printed for the first order, Then 4015 error response.

Next order sent is sending the original order that failed again, It goes through fine the second time. Nothing has changed except the price is 0.02 different.

Here is another example

Sent Order:

[15:08:42:164452591] -info -BINANCE >>>[HTTPS]Send Order: batchOrders=[{“symbol”:“BTCUSDT”,“side”:“SELL”,“type”:“LIMIT”,“timeInForce”:“GTC”,“quantity”:“0.001”,“reduceOnly”:“false”,“price”:“9513.51”},{“symbol”:“BTCUSDT”,“side”:“SELL”,“type”:“LIMIT”,“timeInForce”:“GTC”,“quantity”:“0.001”,“reduceOnly”:“false”,“price”:“9563.51”},{“symbol”:“BTCUSDT”,“side”:“SELL”,“type”:“LIMIT”,“timeInForce”:“GTC”,“quantity”:“0.001”,“reduceOnly”:“false”,“price”:“9613.51”},{“symbol”:“BTCUSDT”,“side”:“SELL”,“type”:“LIMIT”,“timeInForce”:“GTC”,“quantity”:“0.001”,“reduceOnly”:“false”,“price”:“9663.51”},{“symbol”:“BTCUSDT”,“side”:“SELL”,“type”:“LIMIT”,“timeInForce”:“GTC”,“quantity”:“0.001”,“reduceOnly”:“false”,“price”:“9713.51”}]&recvWindow=5000&timestamp=1592370522164

Response:

[15:08:42:317952518] -info -BINANCE >>>[HTTPS] Status: 200, Response [ {
“orderId” : 5136194562,
“symbol” : “BTCUSDT”,
“status” : “NEW”,
“clientOrderId” : “DEJe5YCgRqJNmofZ4ipluK”,
“price” : “9513.51”,
“avgPrice” : “0.00000”,
“origQty” : “0.001”,
“executedQty” : “0”,
“cumQty” : “0”,
“cumQuote” : “0”,
“timeInForce” : “GTC”,
“type” : “LIMIT”,
“reduceOnly” : false,
“closePosition” : false,
“side” : “SELL”,
“positionSide” : “BOTH”,
“stopPrice” : “0”,
“workingType” : “CONTRACT_PRICE”,
“origType” : “LIMIT”,
“updateTime” : 1592370522227
}, {
“code” : -4015,
“msg” : “Client order id is not valid.”
}, {
“orderId” : 5136194564,
“symbol” : “BTCUSDT”,
“status” : “NEW”,
“clientOrderId” : “ACasCX4Uj00SZquTYoeCvX”,
“price” : “9613.51”,
“avgPrice” : “0.00000”,
“origQty” : “0.001”,
“executedQty” : “0”,
“cumQty” : “0”,
“cumQuote” : “0”,
“timeInForce” : “GTC”,
“type” : “LIMIT”,
“reduceOnly” : false,
“closePosition” : false,
“side” : “SELL”,
“positionSide” : “BOTH”,
“stopPrice” : “0”,
“workingType” : “CONTRACT_PRICE”,
“origType” : “LIMIT”,
“updateTime” : 1592370522227
}, {
“code” : -4015,
“msg” : “Client order id is not valid.”
}, {
“orderId” : 5136194560,
“symbol” : “BTCUSDT”,
“status” : “NEW”,
“clientOrderId” : “Gim98JvgwuubJPhpjYx9TA”,
“price” : “9713.51”,
“avgPrice” : “0.00000”,
“origQty” : “0.001”,
“executedQty” : “0”,
“cumQty” : “0”,
“cumQuote” : “0”,
“timeInForce” : “GTC”,
“type” : “LIMIT”,
“reduceOnly” : false,
“closePosition” : false,
“side” : “SELL”,
“positionSide” : “BOTH”,
“stopPrice” : “0”,
“workingType” : “CONTRACT_PRICE”,
“origType” : “LIMIT”,
“updateTime” : 1592370522226
} ]

That’s kind of the point, It works fine most of the time. Then sometimes I get random responses about a parameter I didn’t send and never have.

Maybe it is worth noting that I am sending these requests in the request body, and not in the query string. Even so, Api documentation says that it is fine to do that.

These responses are showing up about 3% of the time, Each time I am checking the data I am sending and it is all perfectly consistent with the above, Which is inline with api documentation. From what I am seeing everything on my end is consistent. I can provide a lot more examples if you’d like.

Its very strange that I would get a client order ID error, Especially since I don’t use them at all in my code. Strongly suspect this is on your end.

It would be great to talk to a dev about this.

it looks wired, if the client order id is not provide, it shouldn’t checked.
Please provide the raw requested url, then we have a look, no signature.

Or this script be can used for testing the batch order endpoint:

could you please share the value in param batchOrders, which return this error, I will have a try in my ending.
thanks

btw you should encoding the json string in the url.

I have a try with these parameters in this scripts, it works fine.

thanks man, i will forward this to the team.

1 Like