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.configuration import Arguments
from freqtrade.worker import Worker
logger = logging.getLogger('freqtrade')
@ -33,16 +32,9 @@ def main(sysargv: List[str] = None) -> None:
arguments = Arguments(sysargv)
args = arguments.get_parsed_arg()
# A subcommand has been issued.
# Means if Backtesting or Hyperopt have been called we exit the bot
# Call subcommand.
if 'func' in args:
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()
return_code = args['func'](args)
except SystemExit as e:
return_code = e