Order failure with {"code":-1013,"msg":"Filter failure: NOTIONAL"} even when everything is allright

Hi,

Last night I started receiving multiple random {"code":-1013,"msg":"Filter failure: NOTIONAL"} regarding some of my market orders. Time in the logs is UTC.

07/31/2023 19:42:18 -     INFO - STRATEGY BUY 0.428 x MLNUSDT @ 23.93
07/31/2023 19:42:18 -    ERROR - Request error: 400 - {"code":-1013,"msg":"Filter failure: NOTIONAL"}

The notional filter for MLNUSDT is:

{'symbol': 'MLNUSDT',
 'baseAsset': 'MLN',
 'quoteAsset': 'USDT',
 'baseAssetPrecision': 8,
 'quoteAssetPrecision': 8,
 'quoteOrderQtyMarketAllowed': True,
 'LOT_SIZE': {'stepSize': 0.001, 'minQty': 0.001, 'maxQty': 9222449.0},
 'MARKET_LOT_SIZE': {'stepSize': 0.0, 'minQty': 0.0, 'maxQty': 1687.7079125},
 'NOTIONAL': {'minNotional': 10.0,
  'maxNotional': 9000000.0,
  'applyMinToMarket': True,
  'applyMaxToMarket': False}}

As you can see, all LOT_SIZE, MARKET_LOT_SIZE and NOTIONAL filters can be passed without a problem as:

notional = 0.428 * 23.93 = 10.24204 > 10.0
quantity > minQty from LOT_SIZE

Here’s another failed order due to the same reason:

07/31/2023 20:14:01 -     INFO - STRATEGY BUY 49.9 x ALPACAUSDT @ 0.2054
07/31/2023 20:14:01 -    ERROR - Request error: 400 - {"code":-1013,"msg":"Filter failure: NOTIONAL"}
{'symbol': 'ALPACAUSDT',
 'baseAsset': 'ALPACA',
 'quoteAsset': 'USDT',
 'baseAssetPrecision': 8,
 'quoteAssetPrecision': 8,
 'quoteOrderQtyMarketAllowed': True,
 'LOT_SIZE': {'stepSize': 0.1, 'minQty': 0.1, 'maxQty': 92141578.0},
 'MARKET_LOT_SIZE': {'stepSize': 0.0,
  'minQty': 0.0,
  'maxQty': 416704.76291666},
 'NOTIONAL': {'minNotional': 10.0,
  'maxNotional': 9000000.0,
  'applyMinToMarket': True,
  'applyMaxToMarket': False}}

What could really be the issue? May it be caused by a sudden drop in symbol price right at the moment when I place the orders, thus notional value falls below the limit?

How did you get the price? Based on the API document, you should use the mark price.

The MIN_NOTIONAL filter defines the minimum notional value allowed for an order on a symbol. An order's notional value is the price * quantity. Since MARKET orders have no price, the mark price is used.

1 Like

Hi, thanks for replying!

The documentation states the following:

The MIN_NOTIONAL filter defines the minimum notional value allowed for an order on a symbol. An order’s notional value is the price * quantity. applyToMarket determines whether or not the MIN_NOTIONAL filter will also be applied to MARKET orders. Since MARKET orders have no price, the average price is used over the last avgPriceMins minutes. avgPriceMins is the number of minutes the average price is calculated over. 0 means the last price is used.

I’m using the klines_1s websocket prices coming down the stream in real time. How can I retrieve/determine the mark price (perhaps average price) of a symbol via the spot API/websocket stream?

EDIT: I thing the average price over the last avgPriceMins can be calculated like this:
sum(last 5 minute prices)/avgPriceMins, right?

Sorry I thought you are working on the futures market.

For spot, the price can be found from this endpoint: Binance API Documentation

1 Like