Binance API 返回: APIError(code=-1013): Filter failure: PRICE_FILTER

new*_*yth 5 python binance

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)

有任何想法吗?

Meh*_*KOÇ 6

当您的价格参数不符合交易品种价格过滤器的规范时,就会出现此错误。价格价值至少需要满足三个条件:

  • 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


Pet*_*jda 2

错误文档

“过滤器失败:PRICE_FILTER”

价格太高、太低和/或不遵循符号的刻度大小规则。

解决方案:调整该price值,使其遵循过滤器中设置的规则。每对可以有不同的过滤器值。有关详细信息,请参阅REST API 文档的筛选器部分。