Remove deprecated current_profit from api responses

This commit is contained in:
Matthias 2023-02-28 18:15:58 +01:00
parent bebee15d10
commit 0707e70183
4 changed files with 1 additions and 19 deletions

View File

@ -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]

View File

@ -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,

View File

@ -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

View File

@ -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,