Simplify okx lev_prep

This commit is contained in:
Matthias 2022-03-23 06:49:17 +01:00
parent 5791d0a394
commit 14f9d712dc

View File

@ -58,11 +58,7 @@ class Okx(Exchange):
leverage: float,
side: str # buy or sell
):
if self.trading_mode != TradingMode.SPOT:
if self.margin_mode is None:
raise OperationalException(
f"{self.name}.margin_mode must be set for {self.trading_mode.value}"
)
if self.trading_mode != TradingMode.SPOT and self.margin_mode is not None:
try:
# TODO-lev: Test me properly (check mgnMode passed)
self._api.set_leverage(