Binance futures limit order issue

I have an issue with placing LIMIT order in binance futures. Please consider the following inputs.

def rounded_qty(qty, step_size):
    return round_step_size(qty, step_size)

def get_step_size(sym):
    info = client.get_symbol_info(sym)["filters"]
    for filter in info:
        if filter["filterType"] == "LOT_SIZE":
            return float(filter["stepSize"])

def usdt_to_btc(usdt_qty):
    base_qty = float(usdt_qty) / float(client.get_symbol_ticker(symbol="BTCUSDT")["price"])
    step_size = get_step_size("BTCUSDT")
    return rounded_qty(base_qty, step_size)

symbol = "BTCUSDT"
usdt_qty = 120
btc_qty = usdt_to_btc(usdt_qty)

usdt_to_btc() converts USDT into BTC with LOT_SIZE filter. As binance api returns 0.00001 as LOT_SIZE (stepSize) for BTCUSDT and on the basis of the LOT_SIZE my btc_qty value is 0.00277 wit current rate of BTCUSDT.

So as per binance futures requirement I have btc quantity which is already converted in given lot_size and I place limit order with price and btc_qty which is 0.00277 but it will get error

“binance.exceptions.BinanceAPIException: APIError(code=-1111): Precision is over the maximum defined for this asset”

but when I pass quantity 0.002 (LOT_SIZE - 0.001) instead of 0.00277 (LOT_SIZE - 0.00001) it will executed without error.

Why?

In the endpoint /fapi/v1/exchangeInfo which defines the symbols rules,


 {
   "maxQty": "1000",
   "filterType": "LOT_SIZE",
   "stepSize": "0.001",
   "minQty": "0.001"
}

you will see the step size has 3 decimals, so 0.00277 is not a legitimate value, 0.002 can pass the validation.

1 Like

Thanks mate. It look like I am dumb. I used spot LOT_SIZE instead of futures. Thank you