This commit is contained in:
dsyoon
2023-11-08 23:08:48 +09:00
parent 5ec0d59072
commit c14c71de43

View File

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