0

I want to sell XRP/USDT. It is supposed I have more than the minimum, and even 49 XRP are more than 15usd.

Minimum: 0.10000000 XRP = 49.95301600

sym = 'XRP'
bol = 'USDT'
symbol = sym+bol

from binance.client import Client
client = Client(api_key, api_secret)

# Minimum
minimum = client.get_symbol_info(symbol)
print(minimum['filters'][2]['minQty'])

quantity = client.get_asset_balance(asset=sym)['free']
print(quantity)

order = client.create_order(
    symbol=symbol,
    side=Client.SIDE_SELL,
    type=Client.ORDER_TYPE_MARKET,
    quantity=quantity)

I get:

 File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/binance/client.py", line 1200, in create_order
    return self._post('order', True, data=params)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/binance/client.py", line 240, in _post
    return self._request_api('post', path, signed, version, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/binance/client.py", line 202, in _request_api
    return self._request(method, uri, signed, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/binance/client.py", line 197, in _request
    return self._handle_response()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/binance/client.py", line 230, in _handle_response
    raise BinanceAPIException(self.response)
binance.exceptions.BinanceAPIException: APIError(code=-1013): Filter failure: LOT_SIZE

What am I doing wrong?

MrGuemez
  • 38
  • 2
  • 7

2 Answers2

0

According to the Binance trade rules, and your original post, the minimum for XRP/USDT is 0.1, meaning that you cannot trade in less than 0.1 XRP quantities.

You should try truncating the quantity to one decimal place.

Layne Bernardo
  • 676
  • 3
  • 12
  • So should I set the quantity to 49.9 (one decimal)? – MrGuemez Feb 12 '21 at 03:40
  • Something of that form, yeah. Since quantity is set to the full account balance, I suspect that Binance is returning that with full precision. You could try something like `quantity = math.trunc(quantity*10)/10` – Layne Bernardo Feb 12 '21 at 03:42
0

First of all, you need to call GET /api/v3/exchangeInfo. There you can find FILTER information for every Binance pair. There are several filters for XRPUSDT. That one about LOT_SIZE

    {
      filterType: 'LOT_SIZE',
      minQty: '0.10000000',
      maxQty: '9000000.00000000',
      stepSize: '0.10000000'
    },

So you quantity step must me inside 0.1.

Mike Malyi
  • 983
  • 8
  • 18