exchange.get_liquidation_price check length of positions
This commit is contained in:
parent
9de63412c1
commit
ed320bb2ac
@ -1993,7 +1993,7 @@ class Exchange:
|
|||||||
wallet_balance: float, # Or margin balance
|
wallet_balance: float, # Or margin balance
|
||||||
mm_ex_1: float = 0.0, # (Binance) Cross only
|
mm_ex_1: float = 0.0, # (Binance) Cross only
|
||||||
upnl_ex_1: float = 0.0, # (Binance) Cross only
|
upnl_ex_1: float = 0.0, # (Binance) Cross only
|
||||||
):
|
) -> Optional[float]:
|
||||||
"""
|
"""
|
||||||
Set's the margin mode on the exchange to cross or isolated for a specific pair
|
Set's the margin mode on the exchange to cross or isolated for a specific pair
|
||||||
:param pair: base/quote currency pair (e.g. "ADA/USDT")
|
:param pair: base/quote currency pair (e.g. "ADA/USDT")
|
||||||
@ -2020,8 +2020,11 @@ class Exchange:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
positions = self._api.fetch_positions([pair])
|
positions = self._api.fetch_positions([pair])
|
||||||
|
if len(positions) > 0:
|
||||||
pos = positions[0]
|
pos = positions[0]
|
||||||
return pos['liquidationPrice']
|
return pos['liquidationPrice']
|
||||||
|
else:
|
||||||
|
return None
|
||||||
except ccxt.DDoSProtection as e:
|
except ccxt.DDoSProtection as e:
|
||||||
raise DDosProtection(e) from e
|
raise DDosProtection(e) from e
|
||||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user