init
This commit is contained in:
@@ -4,26 +4,21 @@ from stock.analysis.MovingAverage import MovingAverage
|
||||
class Common:
|
||||
|
||||
# 상향
|
||||
def checkUpward(self, data, idx):
|
||||
def getDirection(self, data, idx, until=10):
|
||||
up, down = 0, 0
|
||||
for i in range(idx, idx-11, -1):
|
||||
if data[i-1] < data[i]:
|
||||
for i in range(idx, idx-(until+1), -1):
|
||||
if data[i - 1] < data[i]:
|
||||
up += 1
|
||||
else:
|
||||
if data[i - 1] > data[i]:
|
||||
down += 1
|
||||
if up > down:
|
||||
return True
|
||||
return False
|
||||
|
||||
# 하향
|
||||
def checkDownward(self, type, data):
|
||||
check = True
|
||||
for i in range(len(data)-1):
|
||||
# 만약 이전이 이후보다 작다면, 하락이 아님
|
||||
if data[i][type] < data[i+1][type]:
|
||||
check = False
|
||||
break
|
||||
return check
|
||||
if down < up:
|
||||
if data[idx - 3] < data[idx]:
|
||||
return 'UP'
|
||||
elif up < down:
|
||||
if data[idx - 3] > data[idx]:
|
||||
return 'DOWN'
|
||||
return 'EVEN'
|
||||
|
||||
# 상향 돌파
|
||||
def checkUpwardBreakthrough(self, type1, type2, data):
|
||||
|
||||
Reference in New Issue
Block a user