mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
some commands should not have config at all
This commit is contained in:
parent
704fea616b
commit
03b5be91f7
|
@ -41,7 +41,9 @@ ARGS_PLOT_DATAFRAME = ["pairs", "indicators1", "indicators2", "plot_limit", "db_
|
|||
ARGS_PLOT_PROFIT = ["pairs", "timerange", "export", "exportfilename", "db_url",
|
||||
"trade_source", "ticker_interval"]
|
||||
|
||||
NO_CONF_REQURIED = ["create-userdir", "download-data", "plot-dataframe", "plot-profit"]
|
||||
NO_CONF_REQURIED = ["download-data", "plot-dataframe", "plot-profit"]
|
||||
|
||||
NO_CONF_ALLOWED = ["create-userdir", "list-exchanges"]
|
||||
|
||||
|
||||
class Arguments:
|
||||
|
@ -75,12 +77,15 @@ class Arguments:
|
|||
parsed_arg = self.parser.parse_args(self.args)
|
||||
|
||||
# When no config is provided, but a config exists, use that configuration!
|
||||
subparser = parsed_arg.subparser if 'subparser' in parsed_arg else None
|
||||
|
||||
# Workaround issue in argparse with action='append' and default value
|
||||
# (see https://bugs.python.org/issue16399)
|
||||
# Allow no-config for certain commands (like downloading / plotting)
|
||||
if (parsed_arg.config is None and ((Path.cwd() / constants.DEFAULT_CONFIG).is_file() or
|
||||
not ('subparser' in parsed_arg and parsed_arg.subparser in NO_CONF_REQURIED))):
|
||||
if (parsed_arg.config is None
|
||||
and subparser not in NO_CONF_ALLOWED
|
||||
and ((Path.cwd() / constants.DEFAULT_CONFIG).is_file()
|
||||
or (subparser not in NO_CONF_REQURIED))):
|
||||
parsed_arg.config = [constants.DEFAULT_CONFIG]
|
||||
|
||||
return parsed_arg
|
||||
|
|
Loading…
Reference in New Issue
Block a user