LOT_SIZE error, but the amounts are fine

Hi all,

I’m fairly new to this and I’ve had a script running fairly consistently for a few weeks. A few days ago, I got the following error making a call to client.order_oco_sell:

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

with code that had previously been working. My code calculates the buy/sell prices and then rounds the figures to two decimal places. I’d made a slight tweak to that, but I don’t think that was the problem, since in the end I just used hard-coded values to test it and got the same error. This is my call from a few days ago, the price has changed since then so the amounts won’t work, but you get the idea:

oco_order = client.order_oco_sell(symbol='ETHBUSD', quantity=1, price='2682.67',
                                  stopPrice='2629.23', stopLimitPrice='2618.55',
                                  stopLimitTimeInForce='GTC')

I was able to enter these figures via the app no problem. I’ve also tried

round_step_size(amount, tick_size)

but I’m getting the same issue. I’ve notice stepSize is now 0.0001, whereas previously is it was 0.00001. I don’t know when this changed or if that has anything to do with it.

Any help would be much appreciated!

Each symbol has the filters defining all rules that client needs to follow to place orders.
You can find all rules from the endpoint /exchangeInfo.

Sometimes you may wish to print out the real parameters sent to server, which may different from what you set in the method.

Yes, I know that, but it doesn’t explain why I’m getting this issue.

This is the result from client.get_symbol_info(‘ETHBUSD’):

{'symbol': 'ETHBUSD', 'status': 'TRADING', 'baseAsset': 'ETH', 'baseAssetPrecision': 8, 'quoteAsset': 'BUSD', 'quotePrecision': 8, 'quoteAssetPrecision': 8, 'baseCommissionPrecision': 8, 'quoteCommissionPrecision': 8, 'orderTypes': ['LIMIT', 'LIMIT_MAKER', 'MARKET', 'STOP_LOSS_LIMIT', 'TAKE_PROFIT_LIMIT'], 'icebergAllowed': True, 'ocoAllowed': True, 'quoteOrderQtyMarketAllowed': True, 'allowTrailingStop': False, 'isSpotTradingAllowed': True, 'isMarginTradingAllowed': True, 'filters': [{'filterType': 'PRICE_FILTER', 'minPrice': '0.01000000', 'maxPrice': '100000.00000000', 'tickSize': '0.01000000'}, {'filterType': 'PERCENT_PRICE', 'multiplierUp': '5', 'multiplierDown': '0.2', 'avgPriceMins': 5}, {'filterType': 'LOT_SIZE', 'minQty': '0.00010000', 'maxQty': '90000.00000000', 'stepSize': '0.00010000'}, {'filterType': 'MIN_NOTIONAL', 'minNotional': '10.00000000', 'applyToMarket': True, 'avgPriceMins': 5}, {'filterType': 'ICEBERG_PARTS', 'limit': 10}, {'filterType': 'MARKET_LOT_SIZE', 'minQty': '0.00000000', 'maxQty': '1073.87326796', 'stepSize': '0.00000000'}, {'filterType': 'MAX_NUM_ORDERS', 'maxNumOrders': 200}, {'filterType': 'MAX_NUM_ALGO_ORDERS', 'maxNumAlgoOrders': 5}], 'permissions': ['SPOT', 'MARGIN']}

As I’ve mentioned previously, I’ve tried round_step_size using the relevant data from this call (tickSize and stepSize).

Why would the parameters being sent to the server differ from those in the code?

Don’t know if there is any issue in the library or anywhere, try this basic python script that is not using any third party, it should help to debug.

1 Like

Nice one - I’ll give that a shot in the next few days. Thanks very much :slight_smile:

Hi,

I’ve only now got round to having a look at this. My issue isn’t about buying, but placing an OCO sell order.

yes, trying the script above to place an OCO order, and see if it works.