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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With