fix: убрать setLeverage на spot — Bybit UTA включает margin автоматически

setLeverage() не работает для spot, генерировал ошибки в логах.
Bybit UTA auto-enables spot margin при покупке с leverage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
anor
2026-03-10 20:41:02 +10:00
co-authored by Claude Opus 4.6
parent 9e3879a9ae
commit eceb766893
+3 -10
View File
@@ -44,18 +44,11 @@ class SpotExecutor:
self._markets_loaded = True
def _ensure_margin(self, symbol: str):
"""Enable spot margin for symbol if leverage > 1."""
"""Mark margin as enabled. Bybit UTA enables spot margin automatically."""
if self.leverage <= 1 or self._margin_enabled:
return
try:
self.exchange.set_leverage(self.leverage, symbol, params={
"category": "spot",
})
self._margin_enabled = True
log.info(f"Spot margin enabled: {self.leverage}x for {symbol}")
except Exception as e:
self._margin_enabled = True # don't retry every cycle
log.info(f"Spot margin API not available ({e}), using exchange default")
# Bybit UTA: spot margin is auto-enabled, setLeverage not supported for spot
self._margin_enabled = True
def get_balance(self, coin: str) -> float:
"""Get free balance for a coin."""