diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index ba081d960..2ff999fdb 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -133,7 +133,7 @@ class FreqtradeBot(object): f'*Strategy:* `{strategy_name}`' }) if self.config.get('dynamic_whitelist', False): - top_pairs = 'top ' + str(self.config.get('dynamic_whitelist', False)) + top_pairs = 'top ' + str(self.config.get('dynamic_whitelist', 20)) specific_pairs = '' else: top_pairs = 'whitelisted' diff --git a/freqtrade/tests/rpc/test_rpc_telegram.py b/freqtrade/tests/rpc/test_rpc_telegram.py index 4b2fe4cf5..4d2b9cda2 100644 --- a/freqtrade/tests/rpc/test_rpc_telegram.py +++ b/freqtrade/tests/rpc/test_rpc_telegram.py @@ -1095,6 +1095,38 @@ def test_send_msg_status_notification(default_conf, mocker) -> None: assert msg_mock.call_args[0][0] == '*Status:* `running`' +def test_warning_notification(default_conf, mocker) -> None: + msg_mock = MagicMock() + mocker.patch.multiple( + 'freqtrade.rpc.telegram.Telegram', + _init=MagicMock(), + _send_msg=msg_mock + ) + freqtradebot = get_patched_freqtradebot(mocker, default_conf) + telegram = Telegram(freqtradebot) + telegram.send_msg({ + 'type': RPCMessageType.WARNING_NOTIFICATION, + 'status': 'message' + }) + assert msg_mock.call_args[0][0] == '*Warning:* `message`' + + +def test_custom_notification(default_conf, mocker) -> None: + msg_mock = MagicMock() + mocker.patch.multiple( + 'freqtrade.rpc.telegram.Telegram', + _init=MagicMock(), + _send_msg=msg_mock + ) + freqtradebot = get_patched_freqtradebot(mocker, default_conf) + telegram = Telegram(freqtradebot) + telegram.send_msg({ + 'type': RPCMessageType.CUSTOM_NOTIFICATION, + 'status': '*Custom:* `Hello World`' + }) + assert msg_mock.call_args[0][0] == '*Custom:* `Hello World`' + + def test_send_msg_unknown_type(default_conf, mocker) -> None: msg_mock = MagicMock() mocker.patch.multiple( diff --git a/freqtrade/tests/test_freqtradebot.py b/freqtrade/tests/test_freqtradebot.py index 89adae6ab..fa6bc7c2a 100644 --- a/freqtrade/tests/test_freqtradebot.py +++ b/freqtrade/tests/test_freqtradebot.py @@ -1876,3 +1876,9 @@ def test_get_real_amount_open_trade(default_conf, mocker): freqtrade = FreqtradeBot(default_conf) patch_get_signal(freqtrade) assert freqtrade.get_real_amount(trade, order) == amount + + +def test_startup_messages(default_conf, mocker): + default_conf['dynamic_whitelist'] = 20 + freqtrade = get_patched_freqtradebot(mocker, default_conf) + assert freqtrade.state is State.RUNNING