-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.py
36 lines (26 loc) · 846 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
from datetime import datetime, timedelta
import debugging
import time
from Bank import Bank
from Decision import Decision
from EMA import EMA
from SMA import SMA
# Create a bank with 1,000 USD, 0 Crypto
Bank = Bank(1000, 0, Coin = 'BTC-USD')
Decision = Decision(Bank)
SMA = SMA('BTC-USD')
EMA = EMA('BTC-USD')
def run():
global Decision, SMA, EMA
time.sleep(60)
while (True):
now = datetime.now()
print ('time: {day:02d}-{hour:02d}-{second:02d}'.format(day = now.day, hour = now.hour, second = now.second))
SMA.add_x_minutes(1)
print "Current SMA: " + str(SMA.get_SMA())
EMA.add_x_minutes(1)
print "Current EMA: " + str(EMA.get_EMA())
print "Current Price: " + str(SMA.get_current_price())
Decision.make_decision(EMA.get_EMA(), SMA.get_SMA(), SMA.get_current_price())
time.sleep(60)
run()