-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_checker.py
33 lines (23 loc) · 949 Bytes
/
start_checker.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
import argparse
import logging
import yaml
from dotenv import load_dotenv
from workers.data_checker import BinanceDataChecker
load_dotenv()
def main(config):
sleep_time = config['data_checker']['sleep_time']
manager = BinanceDataChecker(sleep_time)
manager.start_checking()
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--config", required=True, help='Provide config path', type=str)
parser.add_argument('--debug', type=bool)
args = parser.parse_args()
config_path, debug = args.config, args.debug
with open(config_path, 'r') as file:
loaded_config = yaml.safe_load(file)
logging_level = logging.DEBUG if args.debug is not None else logging.INFO
logging.basicConfig(level=logging_level,
filename='logs/binance_ws_checker.log',
format='%(asctime)s - %(levelname)s: %(message)s')
main(loaded_config)