diff --git a/stock/analysis/AnalyzerSqlite.py b/stock/analysis/AnalyzerSqlite.py index e87160b..4a341e2 100644 --- a/stock/analysis/AnalyzerSqlite.py +++ b/stock/analysis/AnalyzerSqlite.py @@ -473,7 +473,7 @@ class AnalyzerSqlite: # RSI가 20 이하인 경우, rsi가 rsis위로 올라온 경우 if len(stock_monthly['close']) > 1: - if stock_monthly['rsi'][0] is not None: + if stock_monthly['rsi'][0] is not None and stock_monthly['rsi'][1] is not None: if stock_monthly['rsi'][0] <= 20: if stock_monthly['rsi'][1] < stock_monthly['rsis'][1] and stock_monthly['rsis'][0] < stock_monthly['rsi'][0]: dir_code = "2" @@ -483,19 +483,20 @@ class AnalyzerSqlite: self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_monthly, status) if len(stock_monthly['volume']) > 5: - # 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) + if stock_monthly['envelope_lower'][0] is not None and stock_monthly['envelope_lower'][1] is not None: + # 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) # 2) daily if len(stock_daily['volume']) > 5: # MSCD -500 이하인 경우 - if stock_daily['macd'][0] is not None: + if stock_daily['macd'][1] is not None and stock_daily['macds'][1] is not None: 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" @@ -549,12 +550,13 @@ class AnalyzerSqlite: self.writeFile(dir_code, dir_name, CODE, NAME, top, stock_daily, status) if len(stock_daily['volume']) > 5: - # BB 하단에 부딪힘 - 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) + if stock_daily['envelope_lower'][0] is not None and stock_daily['envelope_lower'][1] is not None: + # BB 하단에 부딪힘 + 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) if final_status_count >= 5: dir_code = "0"