diff --git a/docs/configuration.md b/docs/configuration.md index 90a39ccc2..15ba4b48d 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -117,7 +117,7 @@ If the value is `stopped` the bot has to be started with `/start` first. ### Understand forcebuy_enable `forcebuy_enable` enables the usage of forcebuy commands via Telegram. -This is disabled for security reasons by default. +This is disabled for security reasons by default, and will show a warning message on startup if enabled. You send `/forcebuy ETH/BTC` to the bot, who buys the pair and holds it until a regular sell-signal appears (ROI, stoploss, /forcesell). Can be dangerous with some strategies, so use with care diff --git a/freqtrade/configuration.py b/freqtrade/configuration.py index d61ff4dd7..e043525a7 100644 --- a/freqtrade/configuration.py +++ b/freqtrade/configuration.py @@ -127,6 +127,9 @@ class Configuration(object): config['db_url'] = constants.DEFAULT_DB_PROD_URL logger.info('Dry run is disabled') + if config.get('forcebuy_enable', False): + logger.warning('`forcebuy` RPC message enabled.') + logger.info(f'Using DB: "{config["db_url"]}"') # Check if the exchange set by the user is supported diff --git a/freqtrade/tests/test_configuration.py b/freqtrade/tests/test_configuration.py index 547c38de9..daaaec090 100644 --- a/freqtrade/tests/test_configuration.py +++ b/freqtrade/tests/test_configuration.py @@ -455,5 +455,19 @@ def test_set_loggers() -> None: assert logging.getLogger('telegram').level is logging.INFO +def test_load_config_warn_forcebuy(default_conf, mocker, caplog) -> None: + default_conf['forcebuy_enable'] = True + mocker.patch('freqtrade.configuration.open', mocker.mock_open( + read_data=json.dumps(default_conf) + )) + + args = Arguments([], '').get_parsed_arg() + configuration = Configuration(args) + validated_conf = configuration.load_config() + + assert validated_conf.get('forcebuy_enable') + assert log_has('`forcebuy` RPC message enabled.', caplog.record_tuples) + + def test_validate_default_conf(default_conf) -> None: validate(default_conf, constants.CONF_SCHEMA)