Cannot open orders on binance with python

I am trying to open order on binance but i always getting

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

I searched it and found solution:

def get_ticksize(symbol):
        info = client.futures_exchange_info()
        for item in info['symbols']:
            if(item['symbol'] == symbol):
                for f in item['filters']:
                    if f['filterType'] == 'PRICE_FILTER':
                        return f['tickSize']
    tick = get_ticksize(symbol)
    print('tick: ' + tick)
    price = round_step_size(float(price), float(tick))
    stopl = round_step_size(float(stopl), float(tick))
    takep = round_step_size(float(takep), float(tick))
    buyorder = client.futures_create_order(symbol=symbol, side=side, type="LIMIT", quantity=q, price=price, timeInForce="GTC")
    stop = client.futures_create_order(symbol=symbol, side="SELL", type="STOP_MARKET", stopPrice=stopl, closePosition="true")
    take = client.futures_create_order(symbol=symbol, side="SELL", type="TAKE_PROFIT_MARKET", stopPrice=takep, closePosition="true")

but i still getting this error. I made printing all prices and it is very strange:

tick: 0.010
BUY EGLDUSDT 51.46 50.43 55.57 1.92
All price rounded to tick but i still getting this error.

                {
                    "stepSize": "0.1",
                    "filterType": "LOT_SIZE",
                    "maxQty": "1000000",
                    "minQty": "0.1"
                }

So for the quantity, it’s up to 1 decimal. But I guess you pass 2 decimals (1.92)

2 Likes

Yes, but how to fix it? I dont uderstand. Please give an example or just change it in my code. Thanks