From 0707e70183e8f534f5683ce827eab8067cc0d831 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 28 Feb 2023 18:15:58 +0100 Subject: [PATCH] Remove deprecated current_profit from api responses --- freqtrade/rpc/api_server/api_schemas.py | 3 --- freqtrade/rpc/rpc.py | 3 --- tests/rpc/test_rpc.py | 11 +---------- tests/rpc/test_rpc_apiserver.py | 3 --- 4 files changed, 1 insertion(+), 19 deletions(-) diff --git a/freqtrade/rpc/api_server/api_schemas.py b/freqtrade/rpc/api_server/api_schemas.py index af64019d5..bb30678ab 100644 --- a/freqtrade/rpc/api_server/api_schemas.py +++ b/freqtrade/rpc/api_server/api_schemas.py @@ -282,9 +282,6 @@ class OpenTradeSchema(TradeSchema): stoploss_current_dist_ratio: Optional[float] stoploss_entry_dist: Optional[float] stoploss_entry_dist_ratio: Optional[float] - current_profit: float - current_profit_abs: float - current_profit_pct: float current_rate: float open_order: Optional[str] diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index ba05d3d7f..807efb4fc 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -210,9 +210,6 @@ class RPC: trade_dict.update(dict( close_profit=trade.close_profit if not trade.is_open else None, current_rate=current_rate, - current_profit=current_profit, # Deprecated - current_profit_pct=round(current_profit * 100, 2), # Deprecated - current_profit_abs=current_profit_abs, # Deprecated profit_ratio=current_profit, profit_pct=round(current_profit * 100, 2), profit_abs=current_profit_abs, diff --git a/tests/rpc/test_rpc.py b/tests/rpc/test_rpc.py index d9b7c764a..e179ec9da 100644 --- a/tests/rpc/test_rpc.py +++ b/tests/rpc/test_rpc.py @@ -68,9 +68,6 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None: 'close_profit': None, 'close_profit_pct': None, 'close_profit_abs': None, - 'current_profit': -0.00408133, - 'current_profit_pct': -0.41, - 'current_profit_abs': -4.09e-06, 'profit_ratio': -0.00408133, 'profit_pct': -0.41, 'profit_abs': -4.09e-06, @@ -134,9 +131,6 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None: 'profit_ratio': 0.0, 'profit_pct': 0.0, 'profit_abs': 0.0, - 'current_profit': 0.0, - 'current_profit_pct': 0.0, - 'current_profit_abs': 0.0, 'stop_loss_abs': 0.0, 'stop_loss_pct': None, 'stop_loss_ratio': None, @@ -187,7 +181,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None: mocker.patch('freqtrade.exchange.Exchange.get_rate', MagicMock(side_effect=ExchangeError("Pair 'ETH/BTC' not available"))) results = rpc._rpc_trade_status() - assert isnan(results[0]['current_profit']) + assert isnan(results[0]['profit_ratio']) assert isnan(results[0]['current_rate']) response_norate = deepcopy(gen_response) # Update elements that are NaN when no rate is available. @@ -198,9 +192,6 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None: 'profit_ratio': ANY, 'profit_pct': ANY, 'profit_abs': ANY, - 'current_profit_abs': ANY, - 'current_profit': ANY, - 'current_profit_pct': ANY, 'current_rate': ANY, }) assert results[0] == response_norate diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 8892995c7..3697fac05 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -1008,9 +1008,6 @@ def test_api_status(botclient, mocker, ticker, fee, markets, is_short, 'close_profit_pct': None, 'close_profit_abs': None, 'close_rate': None, - 'current_profit': ANY, - 'current_profit_pct': ANY, - 'current_profit_abs': ANY, 'profit_ratio': ANY, 'profit_pct': ANY, 'profit_abs': ANY,