init
This commit is contained in:
@@ -268,23 +268,16 @@ class AnalyzerSqlite:
|
|||||||
os.mkdir(outPath)
|
os.mkdir(outPath)
|
||||||
self.makeDir("0", "final")
|
self.makeDir("0", "final")
|
||||||
|
|
||||||
self.makeDir("1", "monthly_6월선_36월선_상향돌파")
|
self.makeDir("1", "monthly_macd_-300이하")
|
||||||
self.makeDir("2", "monthly_종가_12월선_상향돌파")
|
self.makeDir("2", "monthly_rsi_20이하")
|
||||||
self.makeDir("3", "monthly_macd_-300이하")
|
self.makeDir("3", "monthly_EV하단위로_올라옴")
|
||||||
self.makeDir("4", "monthly_rsi_20이하")
|
|
||||||
self.makeDir("5", "monthly_BB하단_내려옴")
|
|
||||||
self.makeDir("6", "monthly_EV하단_내려옴")
|
|
||||||
|
|
||||||
self.makeDir("11", "weekly_4주선_48주선_상향돌파")
|
self.makeDir("11", "daily_macd_-1000이하")
|
||||||
self.makeDir("12", "weekly_종가_12주선_상향돌파")
|
self.makeDir("12", "daily_weekly_monthly_rsi_10_20_30이하")
|
||||||
self.makeDir("13", "weekly_rsi_15이하")
|
self.makeDir("13", "daily_이전에_없던_거래량")
|
||||||
|
self.makeDir("14", "daily_이격도")
|
||||||
self.makeDir("21", "daily_macd_-500이하")
|
self.makeDir("15", "daily_낙폭과대")
|
||||||
self.makeDir("22", "daily_weekly_monthly_rsi_10_20_30이하")
|
self.makeDir("16", "daily_EV하단_내려옴")
|
||||||
self.makeDir("23", "daily_이전에_없던_거래량")
|
|
||||||
self.makeDir("24", "daily_이격도")
|
|
||||||
self.makeDir("25", "daily_낙폭과대")
|
|
||||||
self.makeDir("26", "daily_EV하단_내려옴")
|
|
||||||
|
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -467,130 +460,56 @@ class AnalyzerSqlite:
|
|||||||
if stock_weekly['volume'][0] > 100000 and stock_weekly['close'][0] > 1000:
|
if stock_weekly['volume'][0] > 100000 and stock_weekly['close'][0] > 1000:
|
||||||
|
|
||||||
# 종목 상태 체크 분석
|
# 종목 상태 체크 분석
|
||||||
|
# MACD가 -300 이하에서 macd가 macds 위로 올라온 경우
|
||||||
|
|
||||||
# [Monthly]
|
|
||||||
# 20주선이 40주 선을 상향 돌파함
|
|
||||||
if len(stock_monthly['close']) > 40:
|
|
||||||
if (stock_monthly['avg6'][1] is not None and stock_monthly['avg36'][1] is not None and
|
|
||||||
stock_monthly['avg6'][0] is not None and stock_monthly['avg36'][0] is not None):
|
|
||||||
if stock_monthly['avg6'][1] <= stock_monthly['avg36'][1] and stock_monthly['avg6'][0] > stock_monthly['avg36'][0]:
|
|
||||||
dir_code = "1"
|
|
||||||
dir_name = "monthly_6월선_36월선_상향돌파"
|
|
||||||
final_status_count += 1
|
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status)
|
|
||||||
|
|
||||||
# 종가가 20주선을 상향 돌파함
|
|
||||||
if len(stock_monthly['close']) > 2:
|
|
||||||
if stock_monthly['close'][1] is not None and stock_monthly['avg12'][1] is not None and stock_monthly['close'][0] is not None and stock_monthly['avg12'][0] is not None:
|
|
||||||
if stock_monthly['close'][1] <= stock_monthly['avg12'][1] and stock_monthly['close'][0] > stock_monthly['avg12'][0]:
|
|
||||||
dir_code = "2"
|
|
||||||
dir_name = "monthly_종가_12월선_상향돌파"
|
|
||||||
final_status_count += 1
|
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status)
|
|
||||||
|
|
||||||
# MACD가 0 이하인 경우
|
|
||||||
if len(stock_monthly['close']) > 1:
|
if len(stock_monthly['close']) > 1:
|
||||||
if stock_monthly['macd'][0] is not None:
|
if stock_monthly['macd'][0] is not None:
|
||||||
if stock_monthly['macd'][0] <= -300:
|
if stock_monthly['macd'][0] <= -300:
|
||||||
dir_code = "3"
|
if stock_monthly['macd'][1] < stock_monthly['macds'][1] and stock_monthly['macds'][0] < stock_monthly['macds'][0]:
|
||||||
dir_name = "monthly_macd_-300이하"
|
dir_code = "1"
|
||||||
final_status_count += 1
|
dir_name = "monthly_macd_-300이하"
|
||||||
status = "{:.2f}".format(stock_monthly['macd'][0]) + "_" + status
|
final_status_count += 1
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status)
|
status = "{:.2f}".format(stock_monthly['macd'][0]) + "_" + status
|
||||||
|
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status)
|
||||||
|
|
||||||
# RSI가 20 이하인 경우
|
# RSI가 20 이하인 경우, rsi가 rsis위로 올라온 경우
|
||||||
if len(stock_monthly['close']) > 1:
|
if len(stock_monthly['close']) > 1:
|
||||||
if stock_monthly['rsi'][0] is not None:
|
if stock_monthly['rsi'][0] is not None:
|
||||||
if stock_monthly['rsi'][0] <= 20:
|
if stock_monthly['rsi'][0] <= 20:
|
||||||
dir_code = "4"
|
if stock_monthly['rsi'][1] < stock_monthly['rsis'][1] and stock_monthly['rsis'][0] < stock_monthly['rsi'][0]:
|
||||||
dir_name = "monthly_rsi_20이하"
|
dir_code = "2"
|
||||||
final_status_count += 1
|
dir_name = "monthly_rsi_20이하"
|
||||||
status = "{:.2f}".format(stock_monthly['rsi'][0]) + "_" + status
|
final_status_count += 1
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status)
|
status = "{:.2f}".format(stock_monthly['rsi'][0]) + "_" + status
|
||||||
|
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status)
|
||||||
|
|
||||||
if len(stock_monthly['volume']) > 5:
|
if len(stock_monthly['volume']) > 5:
|
||||||
# BB 하단에 부딪힘
|
# env 하단에 부딪힘
|
||||||
for c_index in range(1, 5):
|
if stock_monthly['close'][1] < stock_monthly['envelope_lower'][1] and stock_monthly['envelope_lower'][0] < stock_monthly['close'][0]:
|
||||||
if stock_monthly['bolingerband_lower'][c_index+1] is None:
|
dir_code = "3"
|
||||||
break
|
dir_name = "monthly_EV하단위로_올라옴"
|
||||||
if stock_monthly['close'][c_index] <= (stock_monthly['bolingerband_lower'][c_index+1]):
|
final_status_count += 1
|
||||||
dir_code = "5"
|
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status)
|
||||||
dir_name = "monthly_BB하단_내려옴"
|
break
|
||||||
final_status_count += 1
|
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status)
|
|
||||||
break
|
|
||||||
|
|
||||||
if len(stock_monthly['volume']) > 5:
|
|
||||||
# BB 하단에 부딪힘
|
|
||||||
for c_index in range(1, 5):
|
|
||||||
if stock_monthly['envelope_lower'][c_index+1] is None:
|
|
||||||
break
|
|
||||||
if stock_monthly['close'][c_index] <= (stock_monthly['envelope_lower'][c_index+1]):
|
|
||||||
dir_code = "6"
|
|
||||||
dir_name = "monthly_EV하단_내려옴"
|
|
||||||
final_status_count += 1
|
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status)
|
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 2) daily
|
||||||
# [Weekly]
|
|
||||||
# 정배열 체크
|
|
||||||
temp_status = self.common.check_RightArrange(stock_weekly)
|
|
||||||
if temp_status != "":
|
|
||||||
status += temp_status
|
|
||||||
|
|
||||||
# 4주선이 48주 선을 상향 돌파함
|
|
||||||
if len(stock_weekly['close']) > 40:
|
|
||||||
if (stock_weekly['avg4'][1] is not None and stock_weekly['avg48'][1] is not None and
|
|
||||||
stock_weekly['avg4'][0] is not None and stock_weekly['avg48'][0] is not None):
|
|
||||||
if stock_weekly['avg4'][1] <= stock_weekly['avg48'][1] and stock_weekly['avg4'][0] > stock_weekly['avg48'][0]:
|
|
||||||
dir_code = "11"
|
|
||||||
dir_name = "weekly_4주선_48주선_상향돌파"
|
|
||||||
final_status_count += 1
|
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_weekly, status)
|
|
||||||
|
|
||||||
# 종가가 20주선을 상향 돌파함
|
|
||||||
if len(stock_weekly['close']) > 2:
|
|
||||||
if stock_weekly['close'][1] is not None and stock_weekly['avg12'][1] is not None and stock_weekly['close'][0] is not None and stock_weekly['avg12'][0] is not None:
|
|
||||||
if stock_weekly['close'][1] <= stock_weekly['avg12'][1] and stock_weekly['close'][0] > stock_weekly['avg12'][0]:
|
|
||||||
dir_code = "12"
|
|
||||||
dir_name = "weekly_종가_12주선_상향돌파"
|
|
||||||
final_status_count += 1
|
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_weekly, status)
|
|
||||||
|
|
||||||
# RSI가 15 이하인 경우
|
|
||||||
if len(stock_monthly['close']) > 1:
|
|
||||||
if stock_weekly['rsi'][0] is not None:
|
|
||||||
if stock_weekly['rsi'][0] <= 15:
|
|
||||||
dir_code = "13"
|
|
||||||
dir_name = "weekly_rsi_15이하"
|
|
||||||
final_status_count += 1
|
|
||||||
status = "{:.2f}".format(stock_weekly['rsi'][0]) + "_" + status
|
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_weekly, status)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 3) daily
|
|
||||||
if len(stock_daily['volume']) > 5:
|
if len(stock_daily['volume']) > 5:
|
||||||
# MSCD -500 이하인 경우
|
# MSCD -500 이하인 경우
|
||||||
if stock_daily['macd'][0] is not None:
|
if stock_daily['macd'][0] is not None:
|
||||||
if stock_daily['macd'][0] <= -500:
|
if stock_daily['macd'][0] <= -1000:
|
||||||
dir_code = "21"
|
if stock_daily['macd'][1] < stock_daily['macds'][1] and stock_daily['macds'][0] < stock_daily['macds'][0]:
|
||||||
dir_name = "daily_macd_-500이하"
|
dir_code = "11"
|
||||||
final_status_count += 1
|
dir_name = "daily_macd_-1000이하"
|
||||||
status = "{:.2f}".format(stock_daily['macd'][0]) + "_" + status
|
final_status_count += 1
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status)
|
status = "{:.2f}".format(stock_daily['macd'][0]) + "_" + status
|
||||||
|
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status)
|
||||||
|
|
||||||
# daily_weekly_monthly_rsi_10_20_30이하
|
# daily_weekly_monthly_rsi_10_20_30이하
|
||||||
if len(stock_monthly['close']) > 1:
|
if len(stock_monthly['close']) > 1:
|
||||||
if stock_monthly['rsi'][0] is not None and stock_weekly['rsi'][0] is not None and stock_daily['rsi'][0] is not None:
|
if stock_monthly['rsi'][0] is not None and stock_weekly['rsi'][0] is not None and stock_daily['rsi'][0] is not None:
|
||||||
if stock_monthly['rsi'][0] <= 30 and stock_weekly['rsi'][0] <= 20 and stock_daily['rsi'][0] <= 10:
|
if stock_monthly['rsi'][0] < 30 and stock_weekly['rsi'][0] < 20 and stock_daily['rsi'][0] < 10:
|
||||||
dir_code = "22"
|
dir_code = "12"
|
||||||
dir_name = "daily_weekly_monthly_rsi_10_20_30이하"
|
dir_name = "daily_weekly_monthly_rsi_10_20_30이하"
|
||||||
final_status_count += 1
|
final_status_count += 1
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status)
|
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status)
|
||||||
@@ -600,7 +519,7 @@ class AnalyzerSqlite:
|
|||||||
if len(stock_daily['volume']) < c_index:
|
if len(stock_daily['volume']) < c_index:
|
||||||
c_index = len(stock_daily['volume'])
|
c_index = len(stock_daily['volume'])
|
||||||
if max(stock_daily['volume'][1:c_index]) < stock_daily['volume'][0]:
|
if max(stock_daily['volume'][1:c_index]) < stock_daily['volume'][0]:
|
||||||
dir_code = "23"
|
dir_code = "13"
|
||||||
dir_name = "daily_이전에_없던_거래량"
|
dir_name = "daily_이전에_없던_거래량"
|
||||||
final_status_count += 1
|
final_status_count += 1
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status)
|
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status)
|
||||||
@@ -609,12 +528,12 @@ class AnalyzerSqlite:
|
|||||||
if (98<stock_daily['disparity_avg5'][0]<102 and 98<stock_daily['disparity_avg10'][0]<102 and
|
if (98<stock_daily['disparity_avg5'][0]<102 and 98<stock_daily['disparity_avg10'][0]<102 and
|
||||||
98<stock_daily['disparity_avg20'][0]<102 and 98<stock_daily['disparity_avg60'][0]<102 and
|
98<stock_daily['disparity_avg20'][0]<102 and 98<stock_daily['disparity_avg60'][0]<102 and
|
||||||
98<stock_daily['disparity_avg120'][0]<102):
|
98<stock_daily['disparity_avg120'][0]<102):
|
||||||
dir_code = "24"
|
dir_code = "14"
|
||||||
dir_name = "daily_이격도"
|
dir_name = "daily_이격도"
|
||||||
final_status_count += 1
|
final_status_count += 1
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status)
|
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status)
|
||||||
|
|
||||||
# daily_낙폭과대 (50% 이상 하락)
|
# daily_낙폭과대 (60% 이상 하락)
|
||||||
c_index = 52*5
|
c_index = 52*5
|
||||||
if len(stock_daily['close']) < c_index:
|
if len(stock_daily['close']) < c_index:
|
||||||
c_index = len(stock_daily['close'])
|
c_index = len(stock_daily['close'])
|
||||||
@@ -623,8 +542,8 @@ class AnalyzerSqlite:
|
|||||||
c_index = idx
|
c_index = idx
|
||||||
|
|
||||||
location = (max(stock_daily['close'][1:c_index]) - stock_daily['close'][0]) / max(stock_daily['close'][1:c_index])
|
location = (max(stock_daily['close'][1:c_index]) - stock_daily['close'][0]) / max(stock_daily['close'][1:c_index])
|
||||||
if location > 0.5:
|
if location > 0.6:
|
||||||
dir_code = "25"
|
dir_code = "15"
|
||||||
dir_name = "daily_낙폭과대"
|
dir_name = "daily_낙폭과대"
|
||||||
final_status_count += 1
|
final_status_count += 1
|
||||||
status = "{:.2f}".format(location) + "_" + status
|
status = "{:.2f}".format(location) + "_" + status
|
||||||
@@ -632,20 +551,12 @@ class AnalyzerSqlite:
|
|||||||
|
|
||||||
if len(stock_daily['volume']) > 5:
|
if len(stock_daily['volume']) > 5:
|
||||||
# BB 하단에 부딪힘
|
# BB 하단에 부딪힘
|
||||||
for c_index in range(3):
|
if stock_daily['close'][1] < stock_daily['envelope_lower'][1] and stock_daily['envelope_lower'][0] < stock_daily['close'][0]:
|
||||||
if stock_daily['envelope_lower'][c_index+1] is None:
|
dir_code = "16"
|
||||||
break
|
dir_name = "daily_EV하단_내려옴"
|
||||||
if (
|
final_status_count += 1
|
||||||
stock_daily['macds'][c_index] < stock_daily['macd'][c_index] and
|
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status)
|
||||||
(stock_daily['close'][c_index+1] < stock_daily['envelope_lower'][c_index+1] or
|
break
|
||||||
stock_daily['close'][c_index+2] < stock_daily['envelope_lower'][c_index+2] or
|
|
||||||
stock_daily['close'][c_index+3] < stock_daily['envelope_lower'][c_index+3])
|
|
||||||
):
|
|
||||||
dir_code = "26"
|
|
||||||
dir_name = "daily_EV하단_내려옴"
|
|
||||||
final_status_count += 1
|
|
||||||
self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status)
|
|
||||||
break
|
|
||||||
|
|
||||||
if final_status_count >= 5:
|
if final_status_count >= 5:
|
||||||
dir_code = "0"
|
dir_code = "0"
|
||||||
|
|||||||
Reference in New Issue
Block a user