APIError(code=-1013): Filter failure: PRICE_FILTER
我无法弄清楚错误是什么。我正在发送此请求:
order = self.client.create_order(
symbol=symbol,
side=side,
timeInForce=TIME_IN_FORCE_GTC,
type=order_type,
quantity=quantity,
price=price
)
Run Code Online (Sandbox Code Playgroud)
它通常有效,但偶尔我会收到前面提到的错误。
我的情况是数量和价格:
quantity = 0.0003
price= 40022.4
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
当您的价格参数不符合交易品种价格过滤器的规范时,就会出现此错误。价格价值至少需要满足三个条件:
minPrice定义允许的最低价格/stopPrice;禁用于minPrice == 0.maxPrice定义允许的最高价格/stopPrice;禁用于maxPrice == 0.tickSize定义价格/stopPrice 可以增加/减少的间隔;禁用于tickSize == 0.要获取任何交易品种的价格过滤器信息,您需要使用GET /api/v3/exchangeInfoAPI。任何使用python-binance库的人都可以使用以下方法来获取PRICE_FILTER所请求符号的信息。
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']))
Run Code Online (Sandbox Code Playgroud)
哪里self.__client是类型binance.client.Client