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:
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user