python-Binance api: APIError(code=-1013): Filter failure: LOT_SIZE

Nassim Oumessoud picture Nassim Oumessoud · May 4, 2020 · Viewed 12.7k times · Source

When trying to place a buy or sell order with the python-binance api I got the following error:

APIError(code=-1013): Filter failure: LOT_SIZE.

Now I've seen at iceberg_parts that this means there is probably something wrong with my buying or selling quantity. I've tried to increase the quantity by a factor 10 but this only gives me another related error:

APIError(code=-1013): Filter failure: MIN_NOTIONAL.

Here's some of my code:

diff = current_price - prev_price
if diff <= 0.0001:
    order = client.order_market_buy(symbol = market , quantity = '0.0001')
    print('buy order')

if diff >= 0.00040:
    order = client.order_market_sell(symbol =market, quantity ='0.0001')
    print('sell order')

Do you know how to fix this?

Answer

Stack picture Stack · Jul 6, 2020

This error appears because you are trying to create an order with a quantity lower than the minimun required.

You can access the minimun required of a specific pair with:

info = client.get_symbol_info('ETHUSDT')
print(info)

Output a dictionary with information about that pair. Now you can access the minimun quantity required with:

print(info['filters'][2]['minQty'])
# 0.00001