From b4b06cbe8032c71cb77f99093044934fd8330ca8 Mon Sep 17 00:00:00 2001 From: dsyoon Date: Sat, 31 Dec 2022 14:28:26 +0900 Subject: [PATCH] init --- stock/analysis/AnalyzerSqlite.py | 56 +++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/stock/analysis/AnalyzerSqlite.py b/stock/analysis/AnalyzerSqlite.py index 1dceb08..c817e4c 100644 --- a/stock/analysis/AnalyzerSqlite.py +++ b/stock/analysis/AnalyzerSqlite.py @@ -273,16 +273,18 @@ class AnalyzerSqlite: self.makeDir("3", "monthly_macd_-300이하") self.makeDir("4", "monthly_rsi_20이하") self.makeDir("5", "monthly_BB하단_내려옴") + self.makeDir("6", "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_이전에_없던_거래량") - self.makeDir("23", "daily_이격도") - self.makeDir("24", "daily_weekly_monthly_rsi_10_20_30이하") + 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하단_내려옴") return @@ -515,7 +517,17 @@ class AnalyzerSqlite: 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 = "5" + dir_name = "monthly_BB하단_내려옴" + final_status_count += 1 + self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status) + break @@ -561,7 +573,7 @@ class AnalyzerSqlite: # 3) daily if len(stock_daily['volume']) > 5: - # RSI가 10 이하인 경우 + # MSCD -500 이하인 경우 if stock_daily['macd'][0] is not None: if stock_daily['macd'][0] <= -500: dir_code = "21" @@ -570,12 +582,21 @@ class AnalyzerSqlite: 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이하 + 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" + 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) + # 2년 중 최대 거래량인 경우 c_index = 520 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 = "22" + dir_code = "23" dir_name = "daily_이전에_없던_거래량" final_status_count += 1 self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status) @@ -584,20 +605,11 @@ class AnalyzerSqlite: if (98 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 = "24" - 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) - # daily_낙폭과대 (50% 이상 하락) c_index = 52*5 if len(stock_daily['close']) < c_index: @@ -614,6 +626,18 @@ class AnalyzerSqlite: status = "{:.2f}".format(location) + "_" + status self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status) + if len(stock_daily['volume']) > 5: + # BB 하단에 부딪힘 + for c_index in range(1, 5): + if stock_daily['envelope_lower'][c_index+1] is None: + break + if stock_daily['close'][c_index] <= (stock_daily['envelope_lower'][c_index+1]): + dir_code = "26" + dir_name = "daily_BB하단_내려옴" + final_status_count += 1 + self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status) + break + if final_status_count >= 5: dir_code = "0" dir_name = "final"