Only adjust stoploss if it's set.

This commit is contained in:
Reigo Reinmets 2021-12-10 23:17:12 +02:00
parent 1e3fc5e984
commit b7bf3247b8
1 changed files with 2 additions and 1 deletions

View File

@ -587,7 +587,8 @@ class LocalTrade():
self.amount = total_amount
self.fee_open_cost = self.fee_open * self.stake_amount
self.recalc_open_trade_value()
self.adjust_stop_loss(self.open_rate, self.stop_loss_pct)
if self.stop_loss_pct is not None and self.open_rate is not None:
self.adjust_stop_loss(self.open_rate, self.stop_loss_pct)
def select_order(self, order_side: str, is_open: Optional[bool]) -> Optional[Order]: