-
Notifications
You must be signed in to change notification settings - Fork 3
/
equityDataClass.py
34 lines (30 loc) · 1.13 KB
/
equityDataClass.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
class equityClass(object):
def __init__(self):
self.equityDate = list()
self.equityItm = list()
self.clsTrdEquity = list()
self.openTrdEquity = list()
self.cumuClsEquity = 0
self.dailyEquityVal = list()
self.peakEquity = 0
self.minEquity = 0
self.maxDD = 0
# tempEqu = 0
# cumEqu = 0
# maxEqu = -999999999
# minEqu = 999999999
# maxDD = 0
def setEquityInfo(self,equityDate,equityItm,clsTrdEquity,openTrdEquity):
self.equityDate.append(equityDate)
self.equityItm.append(equityItm)
self.cumuClsEquity += clsTrdEquity
tempEqu =self.cumuClsEquity+openTrdEquity
self.dailyEquityVal.append(tempEqu)
self.peakEquity = max(self.peakEquity,tempEqu)
maxEqu = self.peakEquity
self.minEquity = min(self.minEquity,tempEqu)
minEqu = self.minEquity
self.maxDD = max(self.maxDD,maxEqu-tempEqu)
# print(self.equityDate[-1]," ",self.maxDD," ",maxEqu," ",tempEqu," ",self.cumuClsEquity)
maxDD = self.maxDD
maxDD = maxDD