diff --git a/stock/analysis/AnalyzerSqlite.py b/stock/analysis/AnalyzerSqlite.py index 8171ec7..b281ea8 100644 --- a/stock/analysis/AnalyzerSqlite.py +++ b/stock/analysis/AnalyzerSqlite.py @@ -583,13 +583,6 @@ class AnalyzerSqlite: dir_name = "daily_final_candidate" log = str(count) + "_" + dir_name + "_" self.writeFile(dir_name, CODE, NAME, top, stock_daily, log) - - check = self.common.buy_stock_candidate(param, stock_daily) - if check: - count += 1 - dir_name = "daily_bol_candidate" - log = str(count) + "_" + dir_name + "_" - self.writeFile(dir_name, CODE, NAME, top, stock_daily, log) return def get_moving_average(self, stock): diff --git a/stock/analysis/Common.py b/stock/analysis/Common.py index a9ae161..21a710a 100644 --- a/stock/analysis/Common.py +++ b/stock/analysis/Common.py @@ -569,64 +569,9 @@ class Common: check = False if len(stock['trend']) < 10: return check - for i in range(10): - if stock['rsi'][i] is None: - return check - for i in range(10): - if stock['slow_k'][i] is None: - return check - - if (stock['close'][1] is None or stock['close'][0] is None or stock['rsi'][1] is None or stock['rsi'][0] is None): - return check - - rise_rate = param['bull'][0] / (param['bull'][0]+param['bear'][0]+param['bull'][0]) - if ( - (stock['macd'][1] < stock['macd'][0] and stock['rsi'][0] < 80) or - (stock['rsi'][1] < stock['rsi'][0] and np.min(stock['rsi'][:3]) < 35) or - (stock['rsi'][0] < 35) or - 0.7 <= rise_rate - ): - # avg300 상승 - if stock['avg300'][1] < stock['avg300'][0]: - # avg5 < trend - if stock['avg5'][0] < stock['trend'][0]: - # avg5 이전 3개 봉 위 - if np.max(stock['avg5'][:3]) < stock['avg5'][0]: - buy_type = "trend" - check = True - - # 상승 추세일 때 - if (stock['macd'][1] < stock['macd'][0] and stock['macds'][0] < stock['macd'][0] or - stock['rsi'][1] < stock['rsi'][0]): - - # rsi가 50을 상향 돌파할 때 - if 0.9 <= rise_rate and np.max(stock['rsi'][:5]) < 50 and 50 < stock['rsi'][0]: - buy_type = "rsi" - check = True - - # golden & 거래량 - if stock['avg120'][0] < stock['avg60'][0] < stock['avg20'][0] < stock['avg5'][0]: - buy_type = "golden" - check = True - - # rsi가 30보다 작은 후에 상승일 때 - if np.min(stock['rsi'][:5]) < 30: - if stock['rsi'][1] < stock['rsi'][0]: - buy_type = "rsi" - check = True - - if not(stock['rsi'][1] < stock['rsi'][0] and stock['rsis'][0] < stock['rsi'][0]): - check = False - - return check - - def buy_stock_candidate(self, param, stock): - check = False - if len(stock['trend']) < 10: - return check - - if np.average(stock['trend'][1:21]) < stock['trend'][0] and np.average(stock['trend_k'][1:21]) < stock['trend_k'][0]: + if np.average(stock['trend'][1:21]) < stock['trend'][0] and np.average(stock['trend_k'][1:21]) < \ + stock['trend_k'][0]: # 1일 트렌드가 시그널 위로 상승 돌파 할 때 if stock['trend_k'][1] <= stock['trend_s'][1] and stock['trend_s'][0] < stock['trend_k'][0]: @@ -637,19 +582,22 @@ class Common: # 추세가 상승 중일 때 매수의 관점 (소추세가 하락해 있을 때 매수의 기회) # macd가 0 이하에서 macd 매수 체크 (macd가 macds를 상승 돌파) - if stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macd'][0] and stock['macd'][0] < np.min(stock['macd'][1:]) * 0.5: + if stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macd'][0] and stock['macd'][ + 0] < np.min(stock['macd'][1:]) * 0.5: if stock['avg120'][0] < stock['trend_k'][0]: # slow_k가 50이하에서 상승 중이고 slow_d를 상승 돌파 할 때 check = True # slow_k가 10이하에서 상승 중이고 slow_d를 상승 돌파 할 때 if stock['slow_k'][0] is not None and stock['slow_k'][1] is not None: - if stock['slow_k'][1] < stock['slow_d'][1] and stock['slow_d'][0] < stock['slow_k'][0] and stock['slow_k'][0] < 10: + if stock['slow_k'][1] < stock['slow_d'][1] and stock['slow_d'][0] < stock['slow_k'][0] and \ + stock['slow_k'][0] < 10: if stock['avg120'][0] < stock['trend_k'][0]: check = True return check + # 낙폭 과대 체크 def check_excessive_drop(self, stock): c_index = 200