Improve variable naming

This commit is contained in:
Matthias 2023-03-13 19:50:19 +01:00
parent cf70deaf8d
commit 8fd13933c3

View File

@ -2758,10 +2758,10 @@ class Exchange:
raise OperationalException( raise OperationalException(
f"{self.name} does not support {self.margin_mode} {self.trading_mode}") f"{self.name} does not support {self.margin_mode} {self.trading_mode}")
isolated_liq = None liquidation_price = None
if self._config['dry_run'] or not self.exchange_has("fetchPositions"): if self._config['dry_run'] or not self.exchange_has("fetchPositions"):
isolated_liq = self.dry_run_liquidation_price( liquidation_price = self.dry_run_liquidation_price(
pair=pair, pair=pair,
open_rate=open_rate, open_rate=open_rate,
is_short=is_short, is_short=is_short,
@ -2776,16 +2776,16 @@ class Exchange:
positions = self.fetch_positions(pair) positions = self.fetch_positions(pair)
if len(positions) > 0: if len(positions) > 0:
pos = positions[0] pos = positions[0]
isolated_liq = pos['liquidationPrice'] liquidation_price = pos['liquidationPrice']
if isolated_liq is not None: if liquidation_price is not None:
buffer_amount = abs(open_rate - isolated_liq) * self.liquidation_buffer buffer_amount = abs(open_rate - liquidation_price) * self.liquidation_buffer
isolated_liq = ( liquidation_price_buffer = (
isolated_liq - buffer_amount liquidation_price - buffer_amount
if is_short else if is_short else
isolated_liq + buffer_amount liquidation_price + buffer_amount
) )
return max(isolated_liq, 0.0) return max(liquidation_price_buffer, 0.0)
else: else:
return None return None