diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index c879676dc..65e16cd35 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -549,7 +549,7 @@ class Telegram(RPCHandler): r['exit_reason'] = r.get('exit_reason', "") lines = [ "*Trade ID:* `{trade_id}`" + - ("` (since {open_date_hum})`" if r['is_open'] else ""), + (" `(since {open_date_hum})`" if r['is_open'] else ""), "*Current Pair:* {pair}", "*Direction:* " + ("`Short`" if r.get('is_short') else "`Long`"), "*Leverage:* `{leverage}`" if r.get('leverage') else "", diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index 5b96a8068..2c9528b5e 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -364,6 +364,22 @@ def test_status_handle(default_conf, update, ticker, fee, mocker) -> None: assert msg_mock.call_count == 2 assert 'LTC/BTC' in msg_mock.call_args_list[0][0][0] + mocker.patch('freqtrade.rpc.telegram.MAX_MESSAGE_LENGTH', 500) + + msg_mock.reset_mock() + context = MagicMock() + context.args = ["2"] + telegram._status(update=update, context=context) + + assert msg_mock.call_count == 2 + + msg1 = msg_mock.call_args_list[0][0][0] + msg2 = msg_mock.call_args_list[1][0][0] + + assert 'Close Rate' not in msg1 + assert 'Trade ID:* `2`' in msg1 + assert 'Trade ID:* `2` - continued' in msg2 + def test_status_table_handle(default_conf, update, ticker, fee, mocker) -> None: mocker.patch.multiple(