2

I've got unexpected Binance API error when trying to submit an order for ETHUSDT. The error looks standard:

{'code': -1013, 'msg': 'Filter failure: PERCENT_PRICE'}

I am passing an average price, retrieved a second ago using API's Symbol Price Ticker functions. My order function looks like:

params = {
    "symbol": "ETHUSDT",
    "side": "BUY",
    "type": "LIMIT",
    "quantity" : 0.1,
    "timeInForce" : "GTC",
    "price" : 3391, #A price from GET /api/v3/ticker/price
    "recvWindow" : 40000
}

response = send_signed_request('POST', '/api/v3/order', params)
print(response)

But when passing a tenfold lower price the order completes without any errors. Also, other symbols don't raise any errors too, using the same pipeline. What am I doing wrong? Looks like bug, but not sure where to submit it.

Any advice will be appreciated!

Paul Bobyrev
  • 97
  • 3
  • 9

1 Answers1

-1

The quantity and price are expected to be in a particular string format for it to work consistently. The Binance documentation on this is here.

You can use this syntax to apply formatting:

amt_str = "{:0.0{}f}".format(amount, precision)

Note that precision in this example is an integer, not a step size.

StevenWhite
  • 5,907
  • 3
  • 21
  • 46
  • Thank for you suggestion! Unfortunately, this does not help. I've also retried with Symbol-BTC pairs to avoid currencies mismatches (some points that the price in order should be in BTC even for USDT pairs, which feels strange to me) and got the same error with LTCBTC. – Paul Bobyrev May 18 '21 at 18:50