Split /stats messages

closes #5869
This commit is contained in:
Matthias 2021-11-14 10:20:04 +01:00
parent 1dc98cc4d5
commit 4d1d8de9b7
2 changed files with 11 additions and 5 deletions

View File

@ -686,10 +686,16 @@ class Telegram(RPCHandler):
count['losses'] count['losses']
] for reason, count in stats['sell_reasons'].items() ] for reason, count in stats['sell_reasons'].items()
] ]
sell_reasons_msg = tabulate( sell_reasons_msg = 'No trades yet.'
sell_reasons_tabulate, for reason in chunks(sell_reasons_tabulate, 25):
headers=['Sell Reason', 'Sells', 'Wins', 'Losses'] sell_reasons_msg = tabulate(
) reason,
headers=['Sell Reason', 'Sells', 'Wins', 'Losses']
)
if len(sell_reasons_tabulate) > 25:
self._send_msg(sell_reasons_msg, ParseMode.MARKDOWN)
sell_reasons_msg = ''
durations = stats['durations'] durations = stats['durations']
duration_msg = tabulate( duration_msg = tabulate(
[ [

View File

@ -731,7 +731,7 @@ def test_telegram_stats(default_conf, update, ticker, ticker_sell_up, fee,
telegram._stats(update=update, context=MagicMock()) telegram._stats(update=update, context=MagicMock())
assert msg_mock.call_count == 1 assert msg_mock.call_count == 1
# assert 'No trades yet.' in msg_mock.call_args_list[0][0][0] assert 'No trades yet.' in msg_mock.call_args_list[0][0][0]
msg_mock.reset_mock() msg_mock.reset_mock()
# Create some test data # Create some test data