init
This commit is contained in:
@@ -290,6 +290,24 @@ class Analyzer:
|
||||
if STOCK[i]['volume'] > 100000 and STOCK[i]['close'] > 2000:
|
||||
# 거래량이 100만 이상이고, 종가가 1천원 이상인지 체크 (https://happpy-rich.tistory.com/94)
|
||||
|
||||
# 5-20
|
||||
days20_line_buying1_status = self.common.check_days20_line_buying1(STOCK, i)
|
||||
if days20_line_buying1_status != "":
|
||||
#if STOCHASTIC[i]['slow_k'] < 40:
|
||||
status += days20_line_buying1_status
|
||||
|
||||
# 5-60
|
||||
days60_line_buying1_status = self.common.check_days60_line_buying1(STOCK, i)
|
||||
if days60_line_buying1_status != "":
|
||||
# if STOCHASTIC[i]['slow_k'] < 40:
|
||||
status += days60_line_buying1_status
|
||||
|
||||
# 20-60
|
||||
days60_line_buying2_status = self.common.check_days60_line_buying2(STOCK, i)
|
||||
if days60_line_buying2_status != "":
|
||||
#if STOCHASTIC[i]['slow_k'] < 40:
|
||||
status += days60_line_buying2_status
|
||||
|
||||
all_upper_cross_status = self.common.checkAllUpperCross(STOCK, i)
|
||||
if all_upper_cross_status != "":
|
||||
status += all_upper_cross_status
|
||||
@@ -312,16 +330,6 @@ class Analyzer:
|
||||
if stochastic_buying_status != "":
|
||||
status += stochastic_buying_status
|
||||
|
||||
# 20
|
||||
if self.common.check_20days_line_buying(STOCK, i):
|
||||
if STOCHASTIC[i]['slow_k'] < 40:
|
||||
status += '20_'
|
||||
|
||||
# 60
|
||||
if self.common.check_60days_line_buying(STOCK, i):
|
||||
if STOCHASTIC[i]['slow_k'] < 40:
|
||||
status += '60_'
|
||||
|
||||
# STOCHASTIC
|
||||
stochastic_status = self.common.check_stochastic(STOCK, STOCHASTIC, i)
|
||||
if stochastic_status != "":
|
||||
@@ -387,14 +395,14 @@ class Analyzer:
|
||||
|
||||
if state != "":
|
||||
fig = self.draw(stock)
|
||||
title = "%s (%s), %s, buy_price (%d), stochastic(%.3f), rsi(%.3f), macd(%.3f), ichimoku(%d)) 차트" % (item_name, item_code, state, buy_price, stochastic_score, rsi_score, macd_score, ichimoku_score)
|
||||
title = "%s (%s), %s, buy_price (%d), stochastic(%.3f), rsi(%.3f), macd(%.3f), ichimoku(%d) 차트" % (item_name, item_code, state, buy_price, stochastic_score, rsi_score, macd_score, ichimoku_score)
|
||||
fig['layout'].update(title=title)
|
||||
fileName = "%s/%s__%.3f__%.3f__%s_%s.html" % (outPath, state, stochastic_score, rsi_score, item_name.replace(" ", ""), item_code)
|
||||
po.write_html(fig, file=fileName, auto_open=False)
|
||||
else:
|
||||
if (RSI[last_index]['rsi_buy'] == 1) and STOCK[last_index]['volume'] > 1000000:
|
||||
fig = self.draw(stock)
|
||||
title = "%s (%s) buy_price (%d), stochastic(%.3f), rsi(%.3f), macd(%.3f), ichimoku(%d)) 차트"%(item_name, item_code, buy_price, stochastic_score, rsi_score, macd_score, ichimoku_score)
|
||||
title = "%s (%s) buy_price (%d), stochastic(%.3f), rsi(%.3f), macd(%.3f), ichimoku(%d) 차트"%(item_name, item_code, buy_price, stochastic_score, rsi_score, macd_score, ichimoku_score)
|
||||
fig['layout'].update(title=title)
|
||||
fileName = "%s/%.3f__%.3f__%s_%s.html"%(tmp_path, stochastic_score, rsi_score, item_name.replace(" ", ""), item_code)
|
||||
po.write_html(fig, file=fileName, auto_open=False)
|
||||
|
||||
@@ -220,12 +220,12 @@ class Common:
|
||||
return "STOCHASTIC#2_"
|
||||
return ""
|
||||
|
||||
def check_20days_line_buying(self, stock, i):
|
||||
def check_days20_line_buying1(self, stock, i):
|
||||
"""
|
||||
3일 선이 20일 선을 뚫고 올라온 순간 체크
|
||||
3일선이 다시 20선 아래로 내려가는 순간 손걸한다.
|
||||
5일 선이 20일 선을 뚫고 올라온 순간 체크
|
||||
5일선이 다시 20선 아래로 내려가는 순간 손걸한다.
|
||||
"""
|
||||
if len(stock) > (i +1):
|
||||
if len(stock) > 61:
|
||||
# 오늘 종가가 20일선을 뚫고 올라왔다. (20일선<오늘종가 and (어제종가<20 or 어제3일선<20))
|
||||
# 오늘 종가는 양봉이어야 한다.
|
||||
# 어제부터 index1일까지 20일선이 3일선 위에 있었다.
|
||||
@@ -233,7 +233,8 @@ class Common:
|
||||
# 이전 3일선이 20일선을 뚫었던 종가보다 오늘 뚫은 종가가 높거나 혹은 오늘 종가가 더 낮더라도 장대 양봉어어야 한다.
|
||||
# 주봉의 20일 평균이 이전 주봉의 20일 평균 보다 높아야 한다.
|
||||
if stock[i]['avg20'] < stock[i]['close'] and (stock[i-1]['close'] < stock[i]['avg20'] or stock[i-1]['avg5'] < stock[i]['avg20']):
|
||||
if (stock[i-4]['avg5'] < stock[i-4]['avg20'] or stock[i-3]['avg5'] < stock[i-3]['avg20'] or stock[i-2]['avg5'] < stock[i-2]['avg20'] or stock[i-1]['avg5'] < stock[i-1]['avg20']):
|
||||
if (stock[i-3]['avg5'] < stock[i-3]['avg20'] or stock[i-2]['avg5'] < stock[i-2]['avg20'] or stock[i-1]['avg5'] < stock[i-1]['avg20']):
|
||||
#if (stock[i - 1]['avg5'] < stock[i - 1]['avg20']):
|
||||
if stock[i]['open'] < stock[i]['close']:
|
||||
index1 = -1
|
||||
for j in range(1, 61):
|
||||
@@ -247,20 +248,47 @@ class Common:
|
||||
break
|
||||
if (index2 != -1 and ((stock[i-index2+1]['close'] < stock[i]['close']) or (stock[i]['high']-stock[i]['close'] < stock[i]['open']-stock[i]['low']))):
|
||||
# 주봉의 20일 평균이 이전 주봉의 20일 평균 보다 높아야 한다.
|
||||
return "20_"
|
||||
return "5-20_"
|
||||
return ""
|
||||
|
||||
def check_60days_line_buying(self, stock, i):
|
||||
def check_days60_line_buying1(self, stock, i):
|
||||
"""
|
||||
5일 선이 60일 선을 뚫고 올라온 순간 체크
|
||||
5일선이 다시 60선 아래로 내려가는 순간 손걸한다.
|
||||
"""
|
||||
if len(stock) > 61:
|
||||
# 오늘 5일선이 60일선 위에 올라왔다.
|
||||
# 어제부터 index1일까지 60일선이 5일선 위에 있었다.
|
||||
# index1일부터 index2일까지 5일선이 60일선 위에 있었다.
|
||||
if stock[i]['avg60'] < stock[i]['avg5']:
|
||||
if (stock[i - 3]['avg5'] < stock[i - 3]['avg60'] or stock[i - 2]['avg5'] < stock[i - 2]['avg60'] or stock[i - 1]['avg5'] < stock[i - 1]['avg60']):
|
||||
#if (stock[i - 1]['avg5'] < stock[i - 1]['avg60']):
|
||||
index1 = -1
|
||||
for j in range(1, 150):
|
||||
if stock[i-j]['avg60'] < stock[i-j]['avg5']:
|
||||
index1 = j
|
||||
break
|
||||
index2 = -1
|
||||
for j in range(index1+1, 150):
|
||||
if stock[i-j]['avg5'] < stock[i-j]['avg60']:
|
||||
index2 = j
|
||||
break
|
||||
if (index2 != -1 and (stock[i-index2+1]['close'] < stock[i]['close'])):
|
||||
return "5-60_"
|
||||
return ""
|
||||
|
||||
def check_days60_line_buying2(self, stock, i):
|
||||
"""
|
||||
20일 선이 60일 선을 뚫고 올라온 순간 체크
|
||||
20일선이 다시 60선 아래로 내려가는 순간 손걸한다.
|
||||
"""
|
||||
if len(stock) > (i +1):
|
||||
if len(stock) > 151:
|
||||
# 오늘 20일선이 60일선 위에 올라왔다.
|
||||
# 어제부터 index1일까지 60일선이 20일선 위에 있었다.
|
||||
# index1일부터 index2일까지 20일선이 60일선 위에 있었다.
|
||||
if stock[i]['avg60'] < stock[i]['avg20']:
|
||||
if (stock[i - 4]['avg20'] < stock[i - 4]['avg60'] or stock[i - 3]['avg20'] < stock[i - 3]['avg60'] or stock[i - 2]['avg20'] < stock[i - 2]['avg60'] or stock[i - 1]['avg20'] < stock[i - 1]['avg60']):
|
||||
if (stock[i - 3]['avg20'] < stock[i - 3]['avg60'] or stock[i - 2]['avg20'] < stock[i - 2]['avg60'] or stock[i - 1]['avg20'] < stock[i - 1]['avg60']):
|
||||
#if (stock[i - 1]['avg20'] < stock[i - 1]['avg60']):
|
||||
index1 = -1
|
||||
for j in range(1, 150):
|
||||
if stock[i-j]['avg60'] < stock[i-j]['avg20']:
|
||||
@@ -272,7 +300,7 @@ class Common:
|
||||
index2 = j
|
||||
break
|
||||
if (index2 != -1 and (stock[i-index2+1]['close'] < stock[i]['close'])):
|
||||
return "60_"
|
||||
return "20-60_"
|
||||
return ""
|
||||
|
||||
def check_stochastic(self, stock, stochastic, i):
|
||||
|
||||
Reference in New Issue
Block a user