This commit is contained in:
dsyoon
2023-05-05 15:46:29 +09:00
parent c41dfe0515
commit f890eadcee
2 changed files with 33 additions and 49 deletions

View File

@@ -408,18 +408,13 @@ class AnalyzerSqlite:
shutil.rmtree(outPath)
os.mkdir(outPath)
self.makeDir("monthly_macd_n이하")
self.makeDir("monthly_rsi_n이하")
self.makeDir("monthly_env_하단_rsi_50")
self.makeDir("monthly_env_상단")
self.makeDir("weekly_macd_n이하")
self.makeDir("weekly_rsi_n이하")
self.makeDir("daily_macd_n이하")
self.makeDir("daily_rsi_n이하")
self.makeDir("weekly_mv_5_20")
self.makeDir("daily_이전에_없던_거래량")
self.makeDir("daily_이격도")
self.makeDir("daily_낙폭과대")
self.makeDir("daily_EV하단_내려옴")
self.makeDir("daily_BB하단_내려옴")
@@ -466,55 +461,34 @@ class AnalyzerSqlite:
# 종목 상태 체크 분석
# Monthly 체크
if len(stock_monthly['volume']) > 100:
if len(stock_monthly['volume']) > 10:
# MACD가 -300 이하에서 macd가 macds 위로 올라온 경우
check = self.common.check_macd(stock_monthly, -300)
# ENV 하단 상향 돌파
check = self.common.check_env_lower_rsi(stock_monthly)
if check:
dir_name = "monthly_macd_n이하"
log = "MACD_"+"{:.2f}".format(stock_monthly['macd'][0])
dir_name = "monthly_env_하단_rsi_50"
log = "RSI_" + "{:.2f}".format(stock_monthly['rsi'][0])
self.writeFile(dir_name, CODE, NAME, top, stock_monthly, log)
# RSI가 20 이하인 경우, rsi가 rsis위로 올라온 경우
check = self.common.check_rsi(stock_monthly, 20)
# ENV 상단 상향 돌파
check = self.common.check_env_upper(stock_monthly)
if check:
dir_name = "monthly_rsi_n이하"
log = "RSI_"+"{:.2f}".format(stock_monthly['rsi'][0])
dir_name = "monthly_env_상단"
log = "RSI_" + "{:.2f}".format(stock_monthly['rsi'][0])
self.writeFile(dir_name, CODE, NAME, top, stock_monthly, log)
# Weekly 체크
if len(stock_weekly['volume']) > 100:
if len(stock_weekly['volume']) > 20:
# MACD가 -300 이하에서 macd가 macds 위로 올라온 경우
check = self.common.check_macd(stock_weekly, -300)
# 5주
check = self.common.check_week_5_20(stock_weekly)
if check:
dir_name = "weekly_macd_n이하"
log = "MACD_"+"{:.2f}".format(stock_weekly['macd'][0])
self.writeFile(dir_name, CODE, NAME, top, stock_weekly, log)
# RSI가 20 이하인 경우, rsi가 rsis위로 올라온 경우
check = self.common.check_rsi(stock_weekly, 20)
if check:
dir_name = "weekly_rsi_n이하"
dir_name = "weekly_mv_5_20"
log = "RSI_"+"{:.2f}".format(stock_weekly['rsi'][0])
self.writeFile(dir_name, CODE, NAME, top, stock_weekly, log)
# 2) daily
if len(stock_daily['volume']) > 100:
check = self.common.check_macd(stock_daily, -1000)
if check:
dir_name = "daily_macd_n이하"
log = "MACD_"+"{:.2f}".format(stock_daily['macd'][0])
self.writeFile(dir_name, CODE, NAME, top, stock_daily, log)
# RSI가 10 이하인 경우
check = self.common.check_rsi(stock_daily, 10)
if check:
dir_name = "daily_rsi_n이하"
log = "RSI_"+"{:.2f}".format(stock_daily['macd'][0])
self.writeFile(dir_name, CODE, NAME, top, stock_daily, log)
# 52주 200일 기준 평균 + 50% 보다 높은 거래량의 경우
check, log = self.common.check_volume(stock_daily)
@@ -530,13 +504,6 @@ class AnalyzerSqlite:
log = "이격도_" + str(top)
self.writeFile(dir_name, CODE, NAME, top, stock_daily, log)
# daily_낙폭과대 (60% 이상 하락)
check, log = self.common.check_excessive_drop(stock_daily)
if check:
dir_name = "daily_낙폭과대"
log = "낙폭과대_" + log
self.writeFile(dir_name, CODE, NAME, top, stock_daily, log)
# daily_EV하단_내려옴
check = self.common.check_under_EV_Low(stock_daily)
if check:

View File

@@ -495,6 +495,23 @@ class Common:
return True
return False
def check_env_lower_rsi(self, stock):
if stock['close'][1] < stock['envelope_lower'][1] and stock['envelope_lower'][0] < stock['close'][0]:
if stock['rsi'][0] < 50:
return True
return False
def check_env_upper(self, stock):
if stock['close'][1] < stock['envelope_upper'][1] and stock['envelope_upper'][0] < stock['close'][0]:
return True
return False
def check_week_5_20(self, stock):
if stock['avg5'][1] < stock['avg20'][1] and stock['avg20'][0] < stock['avg5'][0]:
return True
return False
# 거래량 체크
# 52주 200일 기준 평균 + 50% 보다 높은 거래량의 경우
def check_volume(self, stock):