Код: Выделить всё
"BTCUSDT": {
"step_size": "0.00001",
"tick_size": "0.01"
},
Код: Выделить всё
APIError(code=-1111): Precision is over the maximum defined for this asset.
Это функции, которые я сейчас использую для усечения цены и количества перед созданием бинанса. ордер (который работает для многих других пар, таких как VETUSDT):
Код: Выделить всё
def __get_trimmed_quantity(self, quantity):
self.logger.log("untrimmed qty: ", quantity)
quantity_dec = Decimal(str(quantity))
step_size_dec = Decimal(str(self.step_size))
trimmed_quantity_dec = quantity_dec.quantize(step_size_dec)
trimmed_quantity = float(trimmed_quantity_dec)
return trimmed_quantity
def __get_trimmed_price(self, price):
self.logger.log("untrimmed price: ", price)
price_dec = Decimal(str(price))
tick_size_dec = Decimal(str(self.tick_size))
trimmed_price_dec = price_dec.quantize(tick_size_dec)
trimmed_price = float(trimmed_price_dec)
return trimmed_price
Код: Выделить всё
untrimmed qty: 0.28760622
untrimmed price: 26193.02
Order to create (binance): {'side': 'SELL', 'positionSide': 'SHORT', 'type': 'LIMIT', 'timeInForce': 'GTC', 'quantity': 0.28761, 'price': 26193.02, 'newClientOrderId': '35021e7298b34c838f0b64e291ead9e1'}
__create_order_to_open_position: Binance order creation failed: APIError(code=-1111): Precision is over the maximum defined for this asset.
Может ли кто-нибудь заметить, что я делаю не так?
Подробнее здесь: https://stackoverflow.com/questions/769 ... defined-fo