python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

Can't sell amounts of crypto with more than 3 decimals

Open fortoken01 opened this issue 5 years ago • 5 comments

I am trying to sell a "0.00031300" of DOGE to USDT by running the following command:

order = client.order_market_sell(symbol='CAKEUSDT', quantity=0.00031300)

and getting the following error

Traceback (most recent call last):
  File "C:\Users\tomi-\PycharmProjects\pythonProject1\test.py", line 31, in <module>
    order = clientbinance.order_market_sell(symbol='CAKEUSDT', quantity=0.00031300)
  File "C:\Users\tomi-\PycharmProjects\pythonProject1\venv\lib\site-packages\binance\client.py", line 1539, in order_market_sell
    return self.order_market(**params)
  File "C:\Users\tomi-\PycharmProjects\pythonProject1\venv\lib\site-packages\binance\client.py", line 1483, in order_market
    return self.create_order(**params)
  File "C:\Users\tomi-\PycharmProjects\pythonProject1\venv\lib\site-packages\binance\client.py", line 1345, in create_order
    return self._post('order', True, data=params)
  File "C:\Users\tomi-\PycharmProjects\pythonProject1\venv\lib\site-packages\binance\client.py", line 323, in _post
    return self._request_api('post', path, signed, version, **kwargs)
  File "C:\Users\tomi-\PycharmProjects\pythonProject1\venv\lib\site-packages\binance\client.py", line 265, in _request_api
    return self._request(method, uri, signed, **kwargs)
  File "C:\Users\tomi-\PycharmProjects\pythonProject1\venv\lib\site-packages\binance\client.py", line 260, in _request
    return self._handle_response()
  File "C:\Users\tomi-\PycharmProjects\pythonProject1\venv\lib\site-packages\binance\client.py", line 313, in _handle_response
    raise BinanceAPIException(self.response)
binance.exceptions.BinanceAPIException: APIError(code=-1013): Filter failure: LOT_SIZE

I can't round this number to 3 decimals because if I do that I get the following output 0.0.

This is really bad since I can make exact transactions if I need to round every single time I want to sell or buy something.

I also didn't find an option to buy/sell the max amount possible with any command.

fortoken01 avatar Apr 28 '21 22:04 fortoken01

@fortoken01 try to see limits in get_exchange_info or get_symbol_info

AlexNik avatar Apr 29 '21 06:04 AlexNik

As Alex said, this is to do with Binance's rules. The smallest amount of Doge you can trade is 0.1, and the minimum order has to be worth 10 USDT. More here: https://www.binance.com/en/trade-rule

ben-hampson avatar Apr 29 '21 16:04 ben-hampson

sorry for the issue, I noticed it hours later of making this issue. well it kinda sucks to not being able to make queries with full sizes cause the fee binance takes from trading disrupts values like 1.000

fortoken01 avatar Apr 29 '21 16:04 fortoken01

You also have the option of using BNB for fees on your trades which keeps your amounts of other crypto cleaner.

sammchardy avatar May 03 '21 03:05 sammchardy

I have also created a blog post going into detail about the Spot filters.

https://sammchardy.github.io/binance/2021/05/03/binance-order-filters.html

sammchardy avatar May 04 '21 00:05 sammchardy