지지 후 돌파 추가
This commit is contained in:
@@ -1,4 +1,16 @@
|
||||
#날짜 종가 오픈 고가 저가 거래량 변동 %
|
||||
2021-03-19 952.11 946.61 953.06 935.27 1.63M 0.24%
|
||||
2021-03-18 949.83 945.11 953.10 945.11 2.06B 0.64%
|
||||
2021-03-17 943.78 941.20 943.78 935.11 2.76B 0.33%
|
||||
2021-03-16 940.65 928.17 941.00 928.17 3.37B 1.48%
|
||||
2021-03-15 926.90 926.04 929.69 921.71 2.34B 0.15%
|
||||
2021-03-12 925.49 910.41 925.90 910.41 2.86B 1.93%
|
||||
2021-03-11 908.01 890.97 908.01 890.97 2.42B 2.02%
|
||||
2021-03-10 890.07 900.19 911.04 890.07 2.88B -0.70%
|
||||
2021-03-09 896.36 904.04 904.04 877.73 3.51B -0.93%
|
||||
2021-03-08 904.77 925.19 931.14 904.62 3.32B -2.03%
|
||||
2021-03-05 923.48 923.32 924.42 907.41 2.17B -0.29%
|
||||
2021-03-04 926.20 929.09 929.09 916.75 2.45B -0.49%
|
||||
2021-03-03 930.80 922.52 930.86 920.07 3.34M 0.83%
|
||||
2021-03-02 923.17 919.17 936.61 914.49 2.96B 1.01%
|
||||
2021-02-26 913.94 930.54 930.54 904.18 2.61M -2.38%
|
||||
|
||||
|
@@ -1,4 +1,16 @@
|
||||
#날짜 종가 오픈 고가 저가 거래량 변동 %
|
||||
2021-03-19 3039.53 3063.01 3063.01 3022.49 1.05M -0.86%
|
||||
2021-03-18 3066.01 3054.93 3090.19 3054.93 1.23B 0.61%
|
||||
2021-03-17 3047.50 3067.76 3069.57 3027.20 814.99M -0.64%
|
||||
2021-03-16 3067.17 3049.23 3071.54 3049.23 1.12B 0.70%
|
||||
2021-03-15 3045.71 3057.06 3065.17 3036.14 1.16B -0.28%
|
||||
2021-03-12 3054.39 3030.73 3061.43 3030.73 1.67B 1.35%
|
||||
2021-03-11 3013.70 2964.30 3028.37 2964.30 1.35B 1.88%
|
||||
2021-03-10 2958.12 2980.76 3013.95 2951.53 905.65M -0.60%
|
||||
2021-03-09 2976.12 2989.96 3000.49 2929.36 1.53B -0.67%
|
||||
2021-03-08 2996.11 3031.99 3055.65 2992.64 1.93B -1.00%
|
||||
2021-03-05 3026.26 3036.16 3036.98 2982.45 1.19B -0.57%
|
||||
2021-03-04 3043.49 3076.88 3076.88 3022.54 1.28B -1.28%
|
||||
2021-03-03 3082.99 3041.20 3083.04 3029.37 2.21M 1.29%
|
||||
2021-03-02 3043.87 3021.68 3096.50 3020.74 1.75B 1.03%
|
||||
2021-02-26 3012.95 3089.49 3089.49 2988.28 1.34M -2.80%
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -291,19 +291,31 @@ class Analyzer:
|
||||
# 거래량이 100만 이상이고, 종가가 1천원 이상인지 체크 (https://happpy-rich.tistory.com/94)
|
||||
|
||||
# 5-20
|
||||
days20_line_buying1_status = self.common.check_days20_line_buying1(STOCK, i)
|
||||
days20_line_buying1_status = self.common.check_days5_20_line_buying(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)
|
||||
days60_line_buying1_status = self.common.check_days5_60_line_buying(STOCK, i)
|
||||
if days60_line_buying1_status != "":
|
||||
# if STOCHASTIC[i]['slow_k'] < 40:
|
||||
status += days60_line_buying1_status
|
||||
|
||||
# 5-120
|
||||
days120_line_buying1_status = self.common.check_days5_120_line_buying(STOCK, i)
|
||||
if days120_line_buying1_status != "":
|
||||
# if STOCHASTIC[i]['slow_k'] < 40:
|
||||
status += days120_line_buying1_status
|
||||
|
||||
# 5-240
|
||||
days240_line_buying1_status = self.common.check_days5_240_line_buying(STOCK, i)
|
||||
if days240_line_buying1_status != "":
|
||||
# if STOCHASTIC[i]['slow_k'] < 40:
|
||||
status += days240_line_buying1_status
|
||||
|
||||
# 20-60
|
||||
days60_line_buying2_status = self.common.check_days60_line_buying2(STOCK, i)
|
||||
days60_line_buying2_status = self.common.check_days20_60_line_buying(STOCK, i)
|
||||
if days60_line_buying2_status != "":
|
||||
#if STOCHASTIC[i]['slow_k'] < 40:
|
||||
status += days60_line_buying2_status
|
||||
@@ -357,10 +369,11 @@ class Analyzer:
|
||||
while result != None:
|
||||
item_code = result[0]
|
||||
item_name = result[1]
|
||||
print("#html", rowid, item_name)
|
||||
|
||||
# 부실 기업은 매수하지 않고 그냥 넘긴다.
|
||||
# kospi 지수와 kosdak 지수도 그냥 넘긴다.
|
||||
if ((item_code in self.fnguide and not self.fnguide[item_code]) or (item_code == "KOSPI" or item_code == "KOSDAK")):
|
||||
if ((item_code in self.fnguide and not self.fnguide[item_code]) or (item_code == "KOSPI" or item_code == "KOSDAK") or result[3] == ''):
|
||||
rowid += 1
|
||||
# 다음 종목을 가져옴
|
||||
cursor.execute('SELECT * FROM ' + self.tableName + ' WHERE rowid=?', (rowid,))
|
||||
@@ -385,29 +398,29 @@ class Analyzer:
|
||||
ICHIMOKU = stock['ICHIMOKU']
|
||||
RSI = stock['RSI']
|
||||
|
||||
# 종목 상태 체크 분석
|
||||
state, buy_price = self.analyzeFinalScore(last_index, STOCK, MACD, STOCHASTIC, ICHIMOKU, RSI)
|
||||
|
||||
stochastic_score = STOCHASTIC[last_index]['slow_k']
|
||||
macd_score = MACD[last_index]['macd']
|
||||
rsi_score = RSI[last_index]['rsi']
|
||||
ichimoku_score = ICHIMOKU[last_index]['ichimoku_buy']
|
||||
if stochastic_score < 50:
|
||||
macd_score = MACD[last_index]['macd']
|
||||
rsi_score = RSI[last_index]['rsi']
|
||||
ichimoku_score = ICHIMOKU[last_index]['ichimoku_buy']
|
||||
|
||||
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)
|
||||
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:
|
||||
# 종목 상태 체크 분석
|
||||
state, buy_price = self.analyzeFinalScore(last_index, STOCK, MACD, STOCHASTIC, ICHIMOKU, RSI)
|
||||
|
||||
if state != "":
|
||||
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), %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/%.3f__%.3f__%s_%s.html"%(tmp_path, stochastic_score, rsi_score, item_name.replace(" ", ""), item_code)
|
||||
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)
|
||||
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)
|
||||
|
||||
print ("#html", rowid, stock['NAME'])
|
||||
rowid += 1
|
||||
cursor.execute('SELECT * FROM ' + self.tableName + ' WHERE rowid=?', (rowid,))
|
||||
result = cursor.fetchone()
|
||||
|
||||
@@ -198,6 +198,15 @@ class Common:
|
||||
return "BEARMARKET#2_"
|
||||
return ""
|
||||
|
||||
def check_stochastic(self, stock, stochastic, i):
|
||||
if i > 2:
|
||||
# 스토케스틱이 15 이하인 경우
|
||||
# 어제보다 slow_k가 상승했고, 오늘 slow_k가 slow_d 위에 있는 경우,
|
||||
if stochastic[i]['slow_k'] < 15:
|
||||
if stochastic[i-1]['slow_k'] < stochastic[i]['slow_k'] and stochastic[i]['slow_d'] < stochastic[i]['slow_k']:
|
||||
return "STOCHASTIC_"
|
||||
return ""
|
||||
|
||||
def check_stochastic_buying(self, stock, stochastic, ichimoku, i):
|
||||
if i > 3:
|
||||
# 삼성전자 2020년 11월 4일
|
||||
@@ -220,17 +229,21 @@ class Common:
|
||||
return "STOCHASTIC#2_"
|
||||
return ""
|
||||
|
||||
def check_days20_line_buying1(self, stock, i):
|
||||
def check_days5_20_line_buying(self, stock, i):
|
||||
"""
|
||||
5일 선이 20일 선을 뚫고 올라온 순간 체크
|
||||
5일선이 다시 20선 아래로 내려가는 순간 손걸한다.
|
||||
"""
|
||||
if stock[i]['close'] == stock[i]['high']:
|
||||
# 윗꼬리 없는 양봉이어야 한다.
|
||||
return ""
|
||||
|
||||
if len(stock) > 61:
|
||||
# 오늘 종가가 20일선을 뚫고 올라왔다. (20일선<오늘종가 and (어제종가<20 or 어제3일선<20))
|
||||
# 오늘 종가가 20일선을 뚫고 올라왔다. (20일선<오늘종가 and (어제종가<20 or 어제5일선<20))
|
||||
# 오늘 종가는 양봉이어야 한다.
|
||||
# 어제부터 index1일까지 20일선이 3일선 위에 있었다.
|
||||
# index1일부터 index2일까지 3일선이 20일선 위에 있었다.
|
||||
# 이전 3일선이 20일선을 뚫었던 종가보다 오늘 뚫은 종가가 높거나 혹은 오늘 종가가 더 낮더라도 장대 양봉어어야 한다.
|
||||
# 어제부터 index1일까지 20일선이 5일선 위에 있었다.
|
||||
# index1일부터 index2일까지 5일선이 20일선 위에 있었다.
|
||||
# 이전 5일선이 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-3]['avg5'] < stock[i-3]['avg20'] or stock[i-2]['avg5'] < stock[i-2]['avg20'] or stock[i-1]['avg5'] < stock[i-1]['avg20']):
|
||||
@@ -246,16 +259,20 @@ class Common:
|
||||
if stock[i-j]['avg5'] < stock[i-j]['avg20']:
|
||||
index2 = j
|
||||
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']))):
|
||||
if (index2 != -1 and ((stock[i-index2]['close'] < stock[i]['close']) or (stock[i]['high']-stock[i]['close'] < stock[i]['open']-stock[i]['low']))):
|
||||
# 주봉의 20일 평균이 이전 주봉의 20일 평균 보다 높아야 한다.
|
||||
return "5-20_"
|
||||
return ""
|
||||
|
||||
def check_days60_line_buying1(self, stock, i):
|
||||
def check_days5_60_line_buying(self, stock, i):
|
||||
"""
|
||||
5일 선이 60일 선을 뚫고 올라온 순간 체크
|
||||
5일선이 다시 60선 아래로 내려가는 순간 손걸한다.
|
||||
"""
|
||||
if stock[i]['close'] == stock[i]['high']:
|
||||
# 윗꼬리 없는 양봉이어야 한다.
|
||||
return ""
|
||||
|
||||
if len(stock) > 61:
|
||||
# 오늘 5일선이 60일선 위에 올라왔다.
|
||||
# 어제부터 index1일까지 60일선이 5일선 위에 있었다.
|
||||
@@ -277,11 +294,15 @@ class Common:
|
||||
return "5-60_"
|
||||
return ""
|
||||
|
||||
def check_days60_line_buying2(self, stock, i):
|
||||
def check_days20_60_line_buying(self, stock, i):
|
||||
"""
|
||||
20일 선이 60일 선을 뚫고 올라온 순간 체크
|
||||
20일선이 다시 60선 아래로 내려가는 순간 손걸한다.
|
||||
"""
|
||||
if stock[i]['close'] == stock[i]['high']:
|
||||
# 윗꼬리 없는 양봉이어야 한다.
|
||||
return ""
|
||||
|
||||
if len(stock) > 151:
|
||||
# 오늘 20일선이 60일선 위에 올라왔다.
|
||||
# 어제부터 index1일까지 60일선이 20일선 위에 있었다.
|
||||
@@ -303,13 +324,29 @@ class Common:
|
||||
return "20-60_"
|
||||
return ""
|
||||
|
||||
def check_stochastic(self, stock, stochastic, i):
|
||||
if i > 2:
|
||||
# 스토케스틱이 15 이하인 경우
|
||||
# 어제보다 slow_k가 상승했고, 오늘 slow_k가 slow_d 위에 있는 경우,
|
||||
if stochastic[i]['slow_k'] < 15:
|
||||
if stochastic[i-1]['slow_k'] < stochastic[i]['slow_k'] and stochastic[i]['slow_d'] < stochastic[i]['slow_k']:
|
||||
return "STOCHASTIC_"
|
||||
def check_days5_120_line_buying(self, stock, i):
|
||||
if stock[i]['close'] == stock[i]['high']:
|
||||
# 윗꼬리 없는 양봉이어야 한다.
|
||||
return ""
|
||||
|
||||
"""
|
||||
5일 선이 120일 선을 뚫고 올라온 순간 체크
|
||||
"""
|
||||
if stock[i-1]['close'] < stock[i-1]['avg120']:
|
||||
if stock[i]['avg120'] < stock[i]['close']:
|
||||
return "5-120_"
|
||||
return ""
|
||||
|
||||
def check_days5_240_line_buying(self, stock, i):
|
||||
if stock[i]['close'] == stock[i]['high']:
|
||||
# 윗꼬리 없는 양봉이어야 한다.
|
||||
return ""
|
||||
|
||||
"""
|
||||
5일 선이 240일 선을 뚫고 올라온 순간 체크
|
||||
"""
|
||||
if stock[i-1]['close'] < stock[i-1]['avg240']:
|
||||
if stock[i]['avg240'] < stock[i]['close']:
|
||||
return "5-240_"
|
||||
return ""
|
||||
|
||||
|
||||
@@ -14,15 +14,6 @@ today = datetime.datetime.now().strftime("%Y-%m-%d")
|
||||
PROJECT_HOME = "../../.."
|
||||
|
||||
start = time.time()
|
||||
print("\n[지수 저장]")
|
||||
kospiFileName = PROJECT_HOME + '/resources/kospi.tsv'
|
||||
kosdakFileName = PROJECT_HOME + '/resources/kosdak.tsv'
|
||||
outFileName = PROJECT_HOME + '/resources/stock.db'
|
||||
crawler = StockCrawler()
|
||||
crawler.saveIndex("KOSPI", kospiFileName, outFileName)
|
||||
crawler.saveIndex("KOSDAK", kosdakFileName, outFileName)
|
||||
|
||||
|
||||
inFnguideFileName = PROJECT_HOME + '/resources/fnguide.db'
|
||||
"""
|
||||
crawler = FnGuideCrawler()
|
||||
|
||||
Reference in New Issue
Block a user