-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathconf.py
More file actions
62 lines (49 loc) · 1.93 KB
/
conf.py
File metadata and controls
62 lines (49 loc) · 1.93 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
"""Load configuration from environment
"""
import os
import ccxt
import yaml
class Configuration():
"""Parses the environment configuration to create the config objects.
"""
def __init__(self):
"""Initializes the Configuration class
"""
with open('defaults.yml', 'r') as config_file:
default_config = yaml.load(config_file)
if os.path.isfile('config.yml'):
with open('config.yml', 'r') as config_file:
user_config = yaml.load(config_file)
else:
user_config = dict()
if 'settings' in user_config:
self.settings = {**default_config['settings'], **user_config['settings']}
else:
self.settings = default_config['settings']
if 'notifiers' in user_config:
self.notifiers = {**default_config['notifiers'], **user_config['notifiers']}
else:
self.notifiers = default_config['notifiers']
if 'indicators' in user_config:
self.indicators = {**default_config['indicators'], **user_config['indicators']}
else:
self.indicators = default_config['indicators']
if 'informants' in user_config:
self.informants = {**default_config['informants'], **user_config['informants']}
else:
self.informants = default_config['informants']
if 'crossovers' in user_config:
self.crossovers = {**default_config['crossovers'], **user_config['crossovers']}
else:
self.crossovers = default_config['crossovers']
if 'exchanges' in user_config:
self.exchanges = user_config['exchanges']
else:
self.exchanges = dict()
for exchange in ccxt.exchanges:
if exchange not in self.exchanges:
self.exchanges[exchange] = {
'required': {
'enabled': False
}
}