Added live isolated-liq get

This commit is contained in:
Sam Germain 2021-11-05 14:25:22 -06:00
parent 778e3bcba6
commit eee7271ab8

View File

@ -1983,6 +1983,26 @@ class Exchange:
else: else:
return 0.0 return 0.0
@retrier
def get_liquidation_price(self, pair: str):
'''
Set's the margin mode on the exchange to cross or isolated for a specific pair
:param symbol: base/quote currency pair (e.g. "ADA/USDT")
'''
if self._config['dry_run'] or not self.exchange_has("fetchPositions"):
# Some exchanges only support one collateral type
return
try:
return self._api.fetch_positions(pair).liquidationPrice
except ccxt.DDoSProtection as e:
raise DDosProtection(e) from e
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
raise TemporaryError(
f'Could not set margin mode due to {e.__class__.__name__}. Message: {e}') from e
except ccxt.BaseError as e:
raise OperationalException(e) from e
def is_exchange_known_ccxt(exchange_name: str, ccxt_module: CcxtModuleType = None) -> bool: def is_exchange_known_ccxt(exchange_name: str, ccxt_module: CcxtModuleType = None) -> bool:
return exchange_name in ccxt_exchanges(ccxt_module) return exchange_name in ccxt_exchanges(ccxt_module)