-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathapp.py
More file actions
47 lines (38 loc) · 1.08 KB
/
app.py
File metadata and controls
47 lines (38 loc) · 1.08 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
#!/usr/local/bin/python
"""Main app module
"""
import time
import sys
import logs
import conf
import structlog
from conf import Configuration
from exchange import ExchangeInterface
from notification import Notifier
from behaviour import Behaviour
def main():
"""Initializes the application
"""
# Load settings and create the config object
config = Configuration()
settings = config.settings
# Set up logger
logs.configure_logging(settings['log_level'], settings['log_mode'])
logger = structlog.get_logger()
# Configure and run configured behaviour.
exchange_interface = ExchangeInterface(config.exchanges)
notifier = Notifier(config.notifiers)
behaviour = Behaviour(
config,
exchange_interface,
notifier
)
while True:
behaviour.run(settings['market_pairs'], settings['output_mode'])
logger.info("Sleeping for %s seconds", settings['update_interval'])
time.sleep(settings['update_interval'])
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
sys.exit(0)