From 865ebc314326cf32af48472d0603416814771f89 Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 7 Mar 2024 17:05:13 +0000 Subject: [PATCH] update status table to show total amounts in stake currency Signed-off-by: Alberto --- freqtrade/rpc/rpc.py | 6 ++++++ tests/rpc/test_rpc.py | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index 6e8447d29..7642d1697 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -291,6 +291,10 @@ class RPC: profit_str += f" ({fiat_profit:.2f})" fiat_profit_sum = fiat_profit if isnan(fiat_profit_sum) \ else fiat_profit_sum + fiat_profit + else: + profit_str += f" ({trade_profit:.2f})" + fiat_profit_sum = trade_profit if isnan(fiat_profit_sum) \ + else fiat_profit_sum + trade_profit active_attempt_side_symbols = [ '*' if (oo and oo.ft_order_side == trade.entry_side) else '**' @@ -317,6 +321,8 @@ class RPC: profitcol = "Profit" if self._fiat_converter: profitcol += " (" + fiat_display_currency + ")" + else: + profitcol += " (" + stake_currency + ")" columns = [ 'ID L/S' if nonspot else 'ID', diff --git a/tests/rpc/test_rpc.py b/tests/rpc/test_rpc.py index 85b105892..bc1fc6227 100644 --- a/tests/rpc/test_rpc.py +++ b/tests/rpc/test_rpc.py @@ -223,8 +223,8 @@ def test_rpc_status_table(default_conf, ticker, fee, mocker) -> None: assert "Pair" in headers assert 'instantly' == result[0][2] assert 'ETH/BTC' in result[0][1] - assert '0.00' == result[0][3] - assert isnan(fiat_profit_sum) + assert '0.00 (0.00)' == result[0][3] + assert '0.00' == f'{fiat_profit_sum:.2f}' mocker.patch(f'{EXMS}._dry_is_price_crossed', return_value=True) freqtradebot.process() @@ -234,8 +234,8 @@ def test_rpc_status_table(default_conf, ticker, fee, mocker) -> None: assert "Pair" in headers assert 'instantly' == result[0][2] assert 'ETH/BTC' in result[0][1] - assert '-0.41%' == result[0][3] - assert isnan(fiat_profit_sum) + assert '-0.41% (-0.00)' == result[0][3] + assert '-0.00' == f'{fiat_profit_sum:.2f}' # Test with fiat convert rpc._fiat_converter = CryptoToFiatConverter()