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