Have main.py support only subcommand mode

This commit is contained in:
Matthias 2019-09-14 11:19:08 +02:00
parent cb37f43277
commit 8664e7f7d3

View File

@ -15,7 +15,6 @@ from typing import Any, List
from freqtrade import OperationalException from freqtrade import OperationalException
from freqtrade.configuration import Arguments from freqtrade.configuration import Arguments
from freqtrade.worker import Worker
logger = logging.getLogger('freqtrade') logger = logging.getLogger('freqtrade')
@ -33,16 +32,9 @@ def main(sysargv: List[str] = None) -> None:
arguments = Arguments(sysargv) arguments = Arguments(sysargv)
args = arguments.get_parsed_arg() args = arguments.get_parsed_arg()
# A subcommand has been issued. # Call subcommand.
# Means if Backtesting or Hyperopt have been called we exit the bot
if 'func' in args: if 'func' in args:
args['func'](args) return_code = args['func'](args)
# TODO: fetch return_code as returned by the command function here
return_code = 0
else:
# Load and run worker
worker = Worker(args)
worker.run()
except SystemExit as e: except SystemExit as e:
return_code = e return_code = e