diff --git a/freqtrade/persistence.py b/freqtrade/persistence.py index 2fe93f440..823bf6dc0 100644 --- a/freqtrade/persistence.py +++ b/freqtrade/persistence.py @@ -281,7 +281,8 @@ class Trade(_DECL_BASE): 'sell_reason': self.sell_reason, 'sell_order_status': self.sell_order_status, - 'stop_loss': self.stop_loss, + 'stop_loss': self.stop_loss, # Deprecated - should not be used + 'stop_loss_abs': self.stop_loss, 'stop_loss_ratio': self.stop_loss_pct if self.stop_loss_pct else None, 'stop_loss_pct': (self.stop_loss_pct * 100) if self.stop_loss_pct else None, 'stoploss_order_id': self.stoploss_order_id, @@ -289,7 +290,8 @@ class Trade(_DECL_BASE): if self.stoploss_last_update else None), 'stoploss_last_update_timestamp': (int(self.stoploss_last_update.timestamp() * 1000) if self.stoploss_last_update else None), - 'initial_stop_loss': self.initial_stop_loss, + 'initial_stop_loss': self.initial_stop_loss, # Deprecated - should not be used + 'initial_stop_loss_abs': self.initial_stop_loss, 'initial_stop_loss_ratio': (self.initial_stop_loss_pct if self.initial_stop_loss_pct else None), 'initial_stop_loss_pct': (self.initial_stop_loss_pct * 100 diff --git a/tests/rpc/test_rpc.py b/tests/rpc/test_rpc.py index dcd525574..eb20e3903 100644 --- a/tests/rpc/test_rpc.py +++ b/tests/rpc/test_rpc.py @@ -81,12 +81,14 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None: 'current_profit': -0.00408133, 'current_profit_pct': -0.41, 'stop_loss': 0.0, + 'stop_loss_abs': 0.0, 'stop_loss_pct': None, 'stop_loss_ratio': None, 'stoploss_order_id': None, 'stoploss_last_update': None, 'stoploss_last_update_timestamp': None, 'initial_stop_loss': 0.0, + 'initial_stop_loss_abs': 0.0, 'initial_stop_loss_pct': None, 'initial_stop_loss_ratio': None, 'open_order': '(limit buy rem=0.00000000)', @@ -137,12 +139,14 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None: 'current_profit': ANY, 'current_profit_pct': ANY, 'stop_loss': 0.0, + 'stop_loss_abs': 0.0, 'stop_loss_pct': None, 'stop_loss_ratio': None, 'stoploss_order_id': None, 'stoploss_last_update': None, 'stoploss_last_update_timestamp': None, 'initial_stop_loss': 0.0, + 'initial_stop_loss_abs': 0.0, 'initial_stop_loss_pct': None, 'initial_stop_loss_ratio': None, 'open_order': '(limit buy rem=0.00000000)', diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 13914fab0..4e4dd7dfd 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -518,12 +518,14 @@ def test_api_status(botclient, mocker, ticker, fee, markets): 'pair': 'ETH/BTC', 'stake_amount': 0.001, 'stop_loss': 0.0, + 'stop_loss_abs': 0.0, 'stop_loss_pct': None, 'stop_loss_ratio': None, 'stoploss_order_id': None, 'stoploss_last_update': None, 'stoploss_last_update_timestamp': None, 'initial_stop_loss': 0.0, + 'initial_stop_loss_abs': 0.0, 'initial_stop_loss_pct': None, 'initial_stop_loss_ratio': None, 'trade_id': 1, @@ -636,12 +638,14 @@ def test_api_forcebuy(botclient, mocker, fee): 'pair': 'ETH/ETH', 'stake_amount': 1, 'stop_loss': None, + 'stop_loss_abs': None, 'stop_loss_pct': None, 'stop_loss_ratio': None, 'stoploss_order_id': None, 'stoploss_last_update': None, 'stoploss_last_update_timestamp': None, 'initial_stop_loss': None, + 'initial_stop_loss_abs': None, 'initial_stop_loss_pct': None, 'initial_stop_loss_ratio': None, 'close_profit': None, diff --git a/tests/test_persistence.py b/tests/test_persistence.py index 942e22a19..ae639511b 100644 --- a/tests/test_persistence.py +++ b/tests/test_persistence.py @@ -762,12 +762,14 @@ def test_to_json(default_conf, fee): 'sell_reason': None, 'sell_order_status': None, 'stop_loss': None, + 'stop_loss_abs': None, 'stop_loss_ratio': None, 'stop_loss_pct': None, 'stoploss_order_id': None, 'stoploss_last_update': None, 'stoploss_last_update_timestamp': None, 'initial_stop_loss': None, + 'initial_stop_loss_abs': None, 'initial_stop_loss_pct': None, 'initial_stop_loss_ratio': None, 'min_rate': None, @@ -806,12 +808,14 @@ def test_to_json(default_conf, fee): 'amount': 100.0, 'stake_amount': 0.001, 'stop_loss': None, + 'stop_loss_abs': None, 'stop_loss_pct': None, 'stop_loss_ratio': None, 'stoploss_order_id': None, 'stoploss_last_update': None, 'stoploss_last_update_timestamp': None, 'initial_stop_loss': None, + 'initial_stop_loss_abs': None, 'initial_stop_loss_pct': None, 'initial_stop_loss_ratio': None, 'close_profit': None,