2

My code

if side == "LONG" and client.futures_get_open_orders(symbol=symbol) == []:
    print(data)
    pos = "BUY"
    q = tbal / price

    q = round(q, 1)
    print(tbal)
    print(q)
    client.futures_change_leverage(symbol=symbol, leverage=info.laverage)
    buyorder = client.futures_create_order(symbol=symbol, side=pos, type="LIMIT", quantity=q, price=price, timeInForce="GTC")

error:

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

I have tried everything, but it still dont working

Andrey Kanava
  • 47
  • 1
  • 8

3 Answers3

0

Error 1111 is simply because the price you have used is above the maximum number of decimal places allowed.

For example, if tickSize returns 0.01, max allowed decimal places for that symbol will be 2.

Alex B
  • 1,092
  • 1
  • 14
  • 39
0

You need to get the pair allowed pricePrecision from binance exchange info endpoint.

Here is the link to the binance docs

dennohpeter
  • 391
  • 4
  • 16
0

You have to pass the symbol with precision defined by Binance. If you check the ticker price on Binance, you will know the precision defined there. Ex: 0.234, precision is 4 , if you pass a value of precision above 4, you will get error 'Precision is over the maximum defined for this asset'

To fix this, read the ticker price from binance, then read 'number of decimals' in the ticker Price, round off the symbol value(price in your case) that you pass to that decimals. It will fix your problem.

#read the ticker price from binance
response = um_futures_client.ticker_price('WOOUSDT')
tickerPrice = response['price']
#read 'number of decimals' in the ticker Price
d = decimal.Decimal(tickerPrice)
print(abs(d.as_tuple().exponent))
numOfDecimals = abs(d.as_tuple().exponent)
# ordering price
price =round(price,numOfDecimals)
srinivas s
  • 71
  • 1
  • 2