Python: 400, -1111, 'Precision is over the maximum defined for this asset.', {'Content-Type': 'application/json', 'Content-Length': '76'

Hi everyone! I am using this code:

from binance.um_futures import UMFutures
leverage = 15
account_info = client.account()
usdt_balance = float(account_info[“availableBalance”])
price = float(client.mark_price(symbol=‘XRPUSDT’)[“markPrice”])
quantity = round(round(usdt_balance * leverage) / price)
quantity = quantity - round(quantity*0.1)
open_order(client, quantity=quantity)

And sometimes get this error:

400, -1111, ‘Precision is over the maximum defined for this asset.’, {‘Content-Type’: ‘application/json’, ‘Content-Length’: ‘76’

It does not appear every time, so i am confused. As you can see, i even rounded every part of the calculations, which now looks stupid.

Hey,
The quantityPrecision for XRPUSDT is 1, which means you cannot send a request with a quantity that has more than one decimal place.
You can find this information using the endpoint GET /fapi/v1/exchangeInfo.