fix: use dynamic quantity/price precision per symbol from exchange info

Hardcoded round(qty, 1) caused -1111 Precision errors for TRXUSDT and
DOGEUSDT (stepSize=1, requires integers). Now lazily loads quantityPrecision
and pricePrecision from Binance futures_exchange_info per symbol. SL/TP
prices also use symbol-specific precision instead of hardcoded 4 decimals.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
21in7
2026-03-08 13:07:23 +09:00
parent 97aef14d6c
commit c6c60b274c
3 changed files with 53 additions and 4 deletions

View File

@@ -248,14 +248,14 @@ class TradingBot:
side=sl_side,
quantity=quantity,
order_type="STOP_MARKET",
stop_price=round(stop_loss, 4),
stop_price=self.exchange._round_price(stop_loss),
reduce_only=True,
)
await self.exchange.place_order(
side=sl_side,
quantity=quantity,
order_type="TAKE_PROFIT_MARKET",
stop_price=round(take_profit, 4),
stop_price=self.exchange._round_price(take_profit),
reduce_only=True,
)