diff --git a/docs/bot-usage.md b/docs/bot-usage.md index cb98e1ea5..b215d7b7c 100644 --- a/docs/bot-usage.md +++ b/docs/bot-usage.md @@ -26,7 +26,8 @@ optional arguments: --version show program's version number and exit -c PATH, --config PATH Specify configuration file (default: None). Multiple - --config options may be used. + --config options may be used. Can be set to '-' to + read config from stdin. -d PATH, --datadir PATH Path to backtest data. -s NAME, --strategy NAME diff --git a/freqtrade/arguments.py b/freqtrade/arguments.py index 35d388432..0e92f8845 100644 --- a/freqtrade/arguments.py +++ b/freqtrade/arguments.py @@ -85,8 +85,9 @@ class Arguments(object): ) self.parser.add_argument( '-c', '--config', - help='Specify configuration file (default: %(default)s). ' - 'Multiple --config options may be used.', + help="Specify configuration file (default: %(default)s). " + "Multiple --config options may be used. " + "Can be set to '-' to read config from stdin.", dest='config', action='append', type=str, diff --git a/freqtrade/configuration.py b/freqtrade/configuration.py index 01bbb955d..47b4bb8f7 100644 --- a/freqtrade/configuration.py +++ b/freqtrade/configuration.py @@ -79,6 +79,7 @@ class Configuration(object): # Now expecting a list of config filenames here, not a string for path in self.args.config: logger.info('Using config: %s ...', path) + # Merge config options, overwriting old values config = deep_merge_dicts(self._load_config_file(path), config) @@ -118,7 +119,8 @@ class Configuration(object): :return: configuration as dictionary """ try: - with open(path) as file: + # Read config from stdin if requested in the options + with open(path) if path != '-' else sys.stdin as file: conf = json.load(file) except FileNotFoundError: raise OperationalException(