forked from antonpenev/python-binance-arbitrage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
46 lines (34 loc) · 1.01 KB
/
config.py
File metadata and controls
46 lines (34 loc) · 1.01 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
#!/usr/bin/env python
import configparser
import sys
# CONFIGS
CONFIG_FILE = 'config.ini'
if len(sys.argv) > 1:
CONFIG_FILE = sys.argv[1]
PARSER = configparser.ConfigParser()
PARSER.read(CONFIG_FILE)
_CONFIG = {
'markets': PARSER.get('all', 'markets').split(' '),
'order_value': PARSER.getfloat('all', 'order_value'),
'min_spread': PARSER.getfloat('all', 'min_spread'),
'api_key': PARSER.get('all', 'api_key'),
'api_secret': PARSER.get('all', 'api_secret'),
'binance_max_precision': '.8f',
'test_mode': PARSER.get('all', 'test_mode'),
'main_wallet': PARSER.get('all', 'main_wallet')
}
def get(key):
return _CONFIG.get(key)
def is_test():
try:
test_mode = PARSER.getboolean('all', 'test_mode')
except configparser.NoOptionError:
print('expection')
test_mode = False
return test_mode
def is_debug():
try:
debug_mode = PARSER.getboolean('all', 'debug')
except configparser.NoOptionError:
debug_mode = False
return debug_mode