Added minor changes from lev-exchange review

This commit is contained in:
Sam Germain
2021-09-10 13:39:42 -06:00
parent 1fa318c52a
commit b0e05b92d3
6 changed files with 51 additions and 38 deletions

View File

@@ -1597,8 +1597,7 @@ class Exchange:
:param pair: The base/quote currency pair being traded
:nominal_value: The total value of the trade in quote currency (collateral + debt)
"""
raise OperationalException(
f"{self.name.capitalize()}.get_max_leverage has not been implemented.")
return 1.0
@retrier
def set_leverage(self, leverage: float, pair: Optional[str]):
@@ -1606,6 +1605,10 @@ class Exchange:
Set's the leverage before making a trade, in order to not
have the same leverage on every trade
"""
if not self.exchange_has("setLeverage"):
# Some exchanges only support one collateral type
return
try:
self._api.set_leverage(symbol=pair, leverage=leverage)
except ccxt.DDoSProtection as e: