当尝试使用python-binance api进行买入或卖出订单时,我得到了以下错误:
APIError(code=-1013): Filter failure: LOT_SIZE.
现在我在iceberg看到,这意味着我的买卖数量可能有问题。我试图将数量增加10倍,但这只会给我带来另一个相关的错误:
APIError(code=-1013): Filter failure: MIN_NOTIONAL.
下面是我的一些代码:
diff = current_price - prev_price
if diff <= 0.0001:
order = client.order_market_buy(symbol = market , quantity = '0.0001')
print('buy order')
if diff >= 0.00040:
order = client.order_market_sell(symbol =market, quantity ='0.0001')
print('sell order')
你知道怎么解决这个问题吗?
发布于 2020-10-08 00:54:50
购买或出售数量必须是>= 10.3USD或10.3 /价格,将数量和价格传递给这些小数设置/过滤器,并使用小数设置的金额
from decimal import Decimal as D, ROUND_DOWN, ROUND_UP
import decimal
info = client.get_symbol_info(symbol=pair)
price_filter = float(info['filters'][0]['tickSize'])
ticker = client.get_symbol_ticker(symbol=pair)
price = float(ticker['price'])
price = D.from_float(price).quantize(D(str(price_filter)))
minimum = float(info['filters'][2]['minQty']) # 'minQty'
quant = D.from_float(quantity).quantize(D(str(minimum))) # if quantity >= 10.3/price
https://stackoverflow.com/questions/61582902
复制相似问题