Merge pull request #324 from kryofly/parse-common

Parsing: common options, reduce function scope
This commit is contained in:
Gérald LONLAS
2018-01-06 15:11:30 -08:00
committed by GitHub
5 changed files with 132 additions and 100 deletions

View File

@@ -398,14 +398,18 @@ def cleanup() -> None:
exit(0)
def main() -> None:
def main(sysargv=sys.argv[1:]) -> None:
"""
Loads and validates the config and handles the main loop
:return: None
"""
global _CONF
args = parse_args(sys.argv[1:])
if not args:
args = parse_args(sysargv,
'Simple High Frequency Trading Bot for crypto currencies')
# A subcommand has been issued
if hasattr(args, 'func'):
args.func(args)
exit(0)
# Initialize logger