diff --git a/stock/analysis/Common.py b/stock/analysis/Common.py index 7207adc..69de7ae 100644 --- a/stock/analysis/Common.py +++ b/stock/analysis/Common.py @@ -579,37 +579,32 @@ class Common: # 매수전략 #1: 깊은 하락 if (stock['macd'][0] < min_macd) and (stock['macdo'][1] <= 0 and 0 < stock['macdo'][0]): if stock['close'][0] < stock['avg200'][0]: - weight = 0.5 - buy = stock['close'][0] - type = 'method1' + return True # 매수전략 #2: RSI 과매도 이후 골든크로스 if (stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macd'][0]): canBuy = False - for c in range(1, 11): - if stock['rsi'][0 - c] < 10: - canBuy = True - break - if canBuy: - weight = 3 - buy = stock['close'][0] - type = 'method2' + if 10 < len(stock['rsi']): + for c in range(1, 11): + if stock['rsi'][0 - c] < 10: + canBuy = True + break + if canBuy: + return True # 매수전략 #3: 다이버전스 if (stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macd'][0]): canBuy = False index = 0 - for c in range(1, 41): - if stock['macd'][0 - c - 1] < stock['macds'][0 - c - 1] and stock['macds'][0 - c] < stock['macd'][0 - c]: - canBuy = True - index = c - break - if canBuy and stock['rsi'][0 - index] < 30: - if (stock['macd'][0 - index] < stock['macd'][0] and - min(stock['open'][0], stock['close'][0]) < min(stock['open'][0 - index], stock['close'][0 - index])): - weight = 2 - buy = stock['close'][0] - type = 'method3' + if 41 < len(stock['rsi']): + for c in range(1, 41): + if stock['macd'][0 - c - 1] < stock['macds'][0 - c - 1] and stock['macds'][0 - c] < stock['macd'][0 - c]: + canBuy = True + index = c + break + if canBuy and stock['rsi'][0 - index] < 30: + if (stock['macd'][0 - index] < stock['macd'][0] and min(stock['open'][0], stock['close'][0]) < min(stock['open'][0 - index], stock['close'][0 - index])): + return True return False