-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
37 lines (25 loc) · 883 Bytes
/
main.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
from models import Coin, Interpreter
from concurrent.futures import ThreadPoolExecutor
import argparse
import json
with open('config.json') as file:
config = json.load(file)
timeframes = config['timeframes']
symbols = config['symbols']
#argparser = argparse.ArgumentParser()
#argparser.add_argument('-c', '--code', help='The code to interpret', required=True)
#code_file = argparser.parse_args().code
code_file = './main.we'
with open(code_file) as file:
code = file.read().split('\n')
code = [i for i in code if i != ""]
coins = []
with ThreadPoolExecutor(max_workers=10) as executor:
for symbol in symbols:
for timeframe in timeframes:
coins.append(Coin(symbol, timeframe))
executor.submit(coins[-1].get_history)
for coin in coins:
interpreter = Interpreter(coin)
for line in code:
interpreter.interpret(line)