Use kwarg for rounding_mode, update tests with additional parameter

This commit is contained in:
Matthias
2023-03-26 10:49:50 +02:00
parent d0d0cbe1d1
commit 0cb28f3d82
12 changed files with 30 additions and 24 deletions

View File

@@ -599,7 +599,7 @@ class LocalTrade():
Method used internally to set self.stop_loss.
"""
stop_loss_norm = price_to_precision(stop_loss, self.price_precision, self.precision_mode,
ROUND_DOWN if self.is_short else ROUND_UP)
rounding_mode=ROUND_DOWN if self.is_short else ROUND_UP)
if not self.stop_loss:
self.initial_stop_loss = stop_loss_norm
self.stop_loss = stop_loss_norm
@@ -630,7 +630,8 @@ class LocalTrade():
if self.initial_stop_loss_pct is None or refresh:
self.__set_stop_loss(new_loss, stoploss)
self.initial_stop_loss = price_to_precision(
new_loss, self.price_precision, self.precision_mode)
new_loss, self.price_precision, self.precision_mode,
rounding_mode=ROUND_DOWN if self.is_short else ROUND_UP)
self.initial_stop_loss_pct = -1 * abs(stoploss)
# evaluate if the stop loss needs to be updated