Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 732
Nassim Oumessoud Avatar asked May 03 '20 23:05

Nassim Oumessoud


People also ask

How does Python connect to Binance API?

Connect to Binance Client Using Python To connect to the client just define your API and secret key variable and execute the client function. To verify that your keys are correct and that you're connected to Binance, execute this function that will ping the server.

How do I get Binance data in Python?

There are two options to do this: use a python package called python-binance. Use the python requests library to get data from binance.

Does Binance use Python?

The Binance API allows algorithmic traders to automate their trading by plugging into the Binance servers using Python or a variety of other programming languages.

What is Binance Python?

Binance API is a method that allows you to connect to the Binance servers using several programming languages. With it, you can automate your trading and make HTTP requests to send and receive data. Here we access Binance API using Python with requests module.


1 Answers

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
like image 175
Stack Avatar answered Nov 15 '22 19:11

Stack