forked from evermarkets/market-maker-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
49 lines (34 loc) · 1.02 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import sys
import yaml
import json
import argparse
from munch import DefaultMunch
from logger.logging import setup_logging
from engine import Engine
import logging
def run(cfg):
logging.basicConfig(level=logging.DEBUG)
engine = Engine(cfg)
engine.run()
def get_config():
parser = argparse.ArgumentParser(description='Trading Engine named Strela')
parser.add_argument('-config', help='a path to configuration file')
args = parser.parse_args()
filename = args.config
with open(filename, 'r') as ymlfile:
cfg_dict = yaml.load(ymlfile)
return DefaultMunch.fromDict(cfg_dict, None)
def start_engine():
cfg = get_config()
if cfg is None:
raise Exception("Unable to connect to config")
try:
logger_name = cfg.logger.name
except Exception:
logger_name = None
logger_name = "mm_bot"
logger = setup_logging(cfg, logger_name)
logger.info("Configurations: %s", json.dumps(cfg))
run(cfg)
if __name__ == "__main__":
start_engine()