'Binance API returns with: APIError(code=-1013): Filter failure: PRICE_FILTER

APIError(code=-1013): Filter failure: PRICE_FILTER

I can't figure out what the error is. I am sending this request:

 order = self.client.create_order(
                symbol=symbol,
                side=side,
                timeInForce=TIME_IN_FORCE_GTC,
                type=order_type,
                quantity=quantity,
                price=price
            )

It usually works but occasionally I get the before mentioned error.

Quantity and Price were in my case:

 quantity = 0.0003 
 price= 40022.4

Any ideas?



Solution 1:[1]

From the error docs:

"Filter failure: PRICE_FILTER"

price is too high, too low, and/or not following the tick size rule for the symbol.

Solution: Adjust the price value so that it follows the rules set in the filter. Each pair can have different filter values. See the Filter section of the REST API docs for more info.

Solution 2:[2]

The "price" data must be a maximum of 5 characters including the period for CARDANO(ADAUSDT).
Like this >>> price= 2.270 <<<

I did this.

def LimitOrderFunc(result):
    try:
        print("---BUY ORDERL---L?M?T ORDER---")
        order = client.order_limit_buy(
            symbol='ADAUSDT',
            quantity=5,
            price=result,
            recvWindow=1000)
    except Exception as e:
        print("an exception occured - {}".format(e))
        return False

return True   


result=""
.
..
...

temporary=myTargetPrice(calculatingData)   # this line return more digit float data.
temporary=str(temporary)                   #Type conversion is done in this line to string data.
counter=0
while counter<5:
   global result
   result+=temporary[counter]
   counter+=1

LimitOrderFunc(result)
result=""

Solution 3:[3]

This error occures when your price parameter does not comply with symbol's price filter's specification. Price value needs to satisfy at least three conditions, which are;

  • minPrice defines the minimum price/stopPrice allowed; disabled on minPrice == 0.
  • maxPrice defines the maximum price/stopPrice allowed; disabled on maxPrice == 0.
  • tickSize defines the intervals that a price/stopPrice can be increased/decreased by; disabled on tickSize == 0.

To get price filter information for any symbol you need to use GET /api/v3/exchangeInfo API. Anyone uses python-binance library can use the following method to get PRICE_FILTER information for the requested symbol.

def get_price_filter(self, symbol):
    data_from_api = self.__client.get_exchange_info()
    symbol_info = next(filter(lambda x: x['symbol'] == symbol, data_from_api['symbols']))
    return next(filter(lambda x: x['filterType'] == 'PRICE_FILTER', symbol_info['filters']))

where self.__client is type of binance.client.Client

Solution 4:[4]

This error can come from specifying too high a precision in the price

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Petr Hejda
Solution 2 Murat Aydogan
Solution 3 Mehmet Kaan ERKOÇ
Solution 4 Markus