From 30fa15609649e43f71746a559053251b5d9e35ea Mon Sep 17 00:00:00 2001 From: Dan Hawk Date: Fri, 5 Jul 2019 09:08:22 +0300 Subject: [PATCH] add posibility to load opts from config file --- cli.py | 2 ++ config/config.ini.dist | 2 ++ lib/cli/RLTraderCLI.py | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 config/config.ini.dist diff --git a/cli.py b/cli.py index 9c56067..710233c 100644 --- a/cli.py +++ b/cli.py @@ -19,6 +19,8 @@ def run_concurrent_optimize(trader: RLTrader, args): logger = init_logger(__name__, show_debug=args.debug) trader = RLTrader(**vars(args), logger=logger) + print(args) + if args.command == 'optimize': run_concurrent_optimize(trader, args) elif args.command == 'train': diff --git a/config/config.ini.dist b/config/config.ini.dist new file mode 100644 index 0000000..cea5095 --- /dev/null +++ b/config/config.ini.dist @@ -0,0 +1,2 @@ +[Defaults] +mini-batches=11 \ No newline at end of file diff --git a/lib/cli/RLTraderCLI.py b/lib/cli/RLTraderCLI.py index 20e8165..d777fc1 100644 --- a/lib/cli/RLTraderCLI.py +++ b/lib/cli/RLTraderCLI.py @@ -1,7 +1,7 @@ import argparse import os import multiprocessing -from configparser import ConfigParser +from configparser import SafeConfigParser class RLTraderCLI: @@ -12,7 +12,7 @@ def __init__(self): defaults = {} if args.from_config: - config = ConfigParser.SafeConfigParser() + config = SafeConfigParser() config.read([args.from_config]) defaults = dict(config.items("Defaults"))