add warning-message when forcebuy_enable is true

This commit is contained in:
Matthias 2018-10-10 20:13:56 +02:00
parent 6ff4c9b888
commit 3de3c246b4
3 changed files with 18 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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)