init
This commit is contained in:
@@ -5,64 +5,82 @@ class BuySellChecker_252670 (BuySellChecker):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
return
|
||||
|
||||
def getBuyPriceAndWeight(self, stock_code, i, data, INFO):
|
||||
buy, weight = -1, -1
|
||||
buy, weight, type = -1, -1, ""
|
||||
|
||||
C_MIN_AVG_5_200 = max(data['disparity_avg5'][i], data['disparity_avg20'][i], data['disparity_avg60'][i], data['disparity_avg200'][i]) - min(data['disparity_avg5'][i], data['disparity_avg20'][i], data['disparity_avg60'][i], data['disparity_avg200'][i])
|
||||
C_MIN_AVG_5_60 = max(data['disparity_avg5'][i], data['disparity_avg20'][i], data['disparity_avg60'][i]) - min(data['disparity_avg5'][i], data['disparity_avg20'][i], data['disparity_avg60'][i])
|
||||
C_DIFF_AVG_200_5 = abs(data['disparity_avg200'][i] - data['disparity_avg5'][i])
|
||||
"""
|
||||
#매수전략 #0: 기준선 위에서 골든크로스
|
||||
if (0 < data['macd'][i] and 0 < data['macds'][i]):
|
||||
if (data['macd'][i-1] < data['macds'][i-1] and data['macds'][i] < data['macd'][i]):
|
||||
canBuy = False
|
||||
for c in range(1, 11):
|
||||
if data['macd'][i - c] < 0:
|
||||
canBuy = True
|
||||
break
|
||||
if canBuy:
|
||||
weight = 1
|
||||
buy = data['close'][i]
|
||||
type = 'method0'
|
||||
"""
|
||||
|
||||
if 0.004 < C_MIN_AVG_5_60 < 0.005 and 0.007 < C_MIN_AVG_5_200 < 0.008 and 0.007 < C_DIFF_AVG_200_5 < 0.008:
|
||||
buy = data['close'][i]
|
||||
weight = 1
|
||||
if 0.023 < C_MIN_AVG_5_60 < 0.024 and 0.026 < C_MIN_AVG_5_200 < 0.027 and 0.026 < C_DIFF_AVG_200_5 < 0.027:
|
||||
buy = data['close'][i]
|
||||
weight = 1
|
||||
if 0.013 < C_MIN_AVG_5_60 < 0.014 and 0.013 < C_MIN_AVG_5_200 < 0.014 and 0.013 < C_DIFF_AVG_200_5 < 0.014:
|
||||
buy = data['close'][i]
|
||||
weight = 1
|
||||
if 0.004 < C_MIN_AVG_5_60 < 0.005 and 0.005 < C_MIN_AVG_5_200 < 0.006 and 0.0008 < C_DIFF_AVG_200_5 < 0.001:
|
||||
buy = data['close'][i]
|
||||
weight = 1
|
||||
if 0.001 < C_MIN_AVG_5_60 < 0.0015 and 0.0055 < C_MIN_AVG_5_200 < 0.006 and 0.0055 < C_DIFF_AVG_200_5 < 0.006:
|
||||
buy = data['close'][i]
|
||||
weight = 1
|
||||
if 0.001 < C_MIN_AVG_5_60 < 0.0015 and 0.0015 < C_MIN_AVG_5_200 < 0.002 and 0.0015 < C_DIFF_AVG_200_5 < 0.002:
|
||||
buy = data['close'][i]
|
||||
weight = 1
|
||||
if 0.009 < C_MIN_AVG_5_60 < 0.0095 and 0.01 < C_MIN_AVG_5_200 < 0.012 and 0.01 < C_DIFF_AVG_200_5 < 0.012:
|
||||
buy = data['close'][i]
|
||||
weight = 1
|
||||
if 0.002 < C_MIN_AVG_5_60 < 0.0023 and 0.0062 < C_MIN_AVG_5_200 < 0.0068 and 0.0062 < C_DIFF_AVG_200_5 < 0.0068:
|
||||
buy = data['close'][i]
|
||||
weight = 1
|
||||
if 0.008 < C_MIN_AVG_5_60 < 0.0085 and 0.008 < C_MIN_AVG_5_200 < 0.0085 and 0.0075 < C_DIFF_AVG_200_5 < 0.008:
|
||||
buy = data['close'][i]
|
||||
weight = 1
|
||||
# 매수전략 #1: 깊은 하락
|
||||
if (data['macd'][i]<-1000) and (data['macdo'][i-1] <= 0 and 0 < data['macdo'][i]):
|
||||
if data['close'][i] < data['avg200'][i]:
|
||||
weight = 0.5
|
||||
buy = data['close'][i]
|
||||
type = 'method1'
|
||||
|
||||
|
||||
# 매수전략 #2: RSI 과매도 이후 골든크로스
|
||||
if (data['macd'][i - 1] < data['macds'][i - 1] and data['macds'][i] < data['macd'][i]):
|
||||
canBuy = False
|
||||
for c in range(1, 11):
|
||||
if data['rsi'][i-c] < 10:
|
||||
canBuy = True
|
||||
break
|
||||
if canBuy:
|
||||
weight = 3
|
||||
buy = data['close'][i]
|
||||
type = 'method2'
|
||||
|
||||
|
||||
# 매수전략 #3: 다이버전스
|
||||
if (data['macd'][i - 1] < data['macds'][i - 1] and data['macds'][i] < data['macd'][i]):
|
||||
canBuy = False
|
||||
index = 0
|
||||
for c in range(1, 41):
|
||||
if data['macd'][i-c-1] < data['macds'][i-c-1] and data['macds'][i-c] < data['macd'][i-c]:
|
||||
canBuy = True
|
||||
index = c
|
||||
break
|
||||
if canBuy and data['rsi'][i-index] < 30:
|
||||
if (data['macd'][i-index] < data['macd'][i] and
|
||||
min(data['open'][i], data['close'][i]) < min(data['open'][i-index], data['close'][i-index])):
|
||||
weight = 2
|
||||
buy = data['close'][i]
|
||||
type = 'method3'
|
||||
|
||||
return buy, weight
|
||||
|
||||
def getSellPriceAndWeight(self, stock_code, i, data, INFO):
|
||||
sell, weight = -1, -1
|
||||
sell, weight, type = -1, -1, ""
|
||||
|
||||
if data['close'][i] < INFO['LIMIT_PRICE'] < data['close'][i-1]:
|
||||
sell = data['close'][i]
|
||||
weight = 1
|
||||
|
||||
if (5 < data['macd'][i]) and (0 < data['macdo'][i-1] and data['macdo'][i] <= 0):
|
||||
# 매수전략 #1: 높은 상승
|
||||
if (650 < data['macd'][i] or 600 < data['macds'][i]) and (0 < data['macdo'][i-1] and data['macdo'][i] <= 0):
|
||||
#if data['macds'][i-1] < data['macd'][i-1] and data['macd'][i] < data['macds'][i]:
|
||||
weight = 1
|
||||
sell = data['close'][i]
|
||||
type = 'method1'
|
||||
|
||||
if data['close'][i] < INFO['LIMIT_PRICE']:
|
||||
weight = 1
|
||||
sell = data['close'][i]
|
||||
# 매수전략 #2: RSI 과매수에서 데드크로스
|
||||
if (data['macds'][i - 1] < data['macd'][i - 1] and data['macd'][i] < data['macds'][i]):
|
||||
if 80 < data['rsi'][i]:
|
||||
weight = 1
|
||||
sell = data['close'][i]
|
||||
type = 'method2'
|
||||
|
||||
return sell, weight
|
||||
|
||||
|
||||
def checkTransaction(self, stock_code, data, INFO, isRealTime=True):
|
||||
# 어제 오늘 데이터로 분석
|
||||
bsLine = {}
|
||||
@@ -105,4 +123,4 @@ class BuySellChecker_252670 (BuySellChecker):
|
||||
bsLine['sell'] = [-1]
|
||||
bsLine['sell_weight'] = [-1]
|
||||
|
||||
return bsLine
|
||||
return bsLine
|
||||
|
||||
Reference in New Issue
Block a user