Simplify leverage_prep interface

This commit is contained in:
Matthias
2022-02-28 19:34:10 +01:00
parent 8e2d3445a7
commit 1d27cbd01f
2 changed files with 3 additions and 6 deletions

View File

@@ -425,11 +425,13 @@ class LocalTrade():
self.stop_loss_pct = -1 * abs(percent)
self.stoploss_last_update = datetime.utcnow()
def set_isolated_liq(self, isolated_liq: float):
def set_isolated_liq(self, isolated_liq: Optional[float]):
"""
Method you should use to set self.liquidation price.
Assures stop_loss is not passed the liquidation price
"""
if not isolated_liq:
return
if self.stop_loss is not None:
if self.is_short:
self.stop_loss = min(self.stop_loss, isolated_liq)