close

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

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error python-Binance api: APIError(code=-1013): Filter failure: LOT_SIZE in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How python-Binance api: APIError(code=-1013): Filter failure: LOT_SIZE Error Occurs?

Today I get the following error python-Binance api: APIError(code=-1013): Filter failure: LOT_SIZE in Python.

How To Solve python-Binance api: APIError(code=-1013): Filter failure: LOT_SIZE Error ?

  1. How To Solve python-Binance api: APIError(code=-1013): Filter failure: LOT_SIZE Error ?

    To Solve python-Binance api: APIError(code=-1013): Filter failure: LOT_SIZE Error The buying or selling quantity has to be >= 10.3 USD or 10.3/price, pass the quantity and price to these decimal settings/filters with the amounts set with decimal

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

    To Solve python-Binance api: APIError(code=-1013): Filter failure: LOT_SIZE Error The buying or selling quantity has to be >= 10.3 USD or 10.3/price, pass the quantity and price to these decimal settings/filters with the amounts set with decimal

Solution 1

The buying or selling quantity has to be >= 10.3 USD or 10.3/price, pass the quantity and price to these decimal settings/filters with the amounts set with decimal

from decimal import Decimal as D, ROUND_DOWN, ROUND_UP
import decimal

info = client.get_symbol_info(symbol=pair)
price_filter = float(info['filters'][0]['tickSize'])
ticker = client.get_symbol_ticker(symbol=pair)
price = float(ticker['price'])
price = D.from_float(price).quantize(D(str(price_filter)))
minimum = float(info['filters'][2]['minQty']) # 'minQty'
quant = D.from_float(quantity).quantize(D(str(minimum))) # if quantity >= 10.3/price

Solution 2

Here is some code.

def round_down(self, coin, number):
    info = self.client.get_symbol_info('%sUSDT' % coin)
    step_size = [float(_['stepSize']) for _ in info['filters'] if _['filterType'] == 'LOT_SIZE'][0]
    step_size = '%.8f' % step_size
    step_size = step_size.rstrip('0')
    decimals = len(step_size.split('.')[1])
    return math.floor(number * 10 ** decimals) / 10 ** decimals

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment