This commit is contained in:
dsyoon
2023-04-16 10:05:54 +09:00
parent 745e455b11
commit c37e26673c
2 changed files with 188 additions and 165 deletions

View File

@@ -479,4 +479,76 @@ class Common:
rate = round((stock["close"][0] - stock["close"][1]) / stock["close"][1], 2)
if rate <= limit:
return "1d("+str(rate)+")_"
return ""
return ""
# macd가 n보다 낮은 지 체크
def check_macd(self, stock, n=-1000):
if stock['macd'][0] <= n:
if stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macds'][0]:
return True,
return False
def check_rsi(self, stock, n=10):
if stock['macd'][0] <= n:
if stock['macd'][1] < stock['macds'][1] and stock['macds'][0] < stock['macds'][0]:
return True
return False
# 거래량 체크
# 52주 200일 기준 평균 + 50% 보다 높은 거래량의 경우
def check_volume(self, stock):
c_index = 200
if len(stock['volume']) < c_index:
c_index = len(stock['volume'])
max_volume = max(stock['volume'][1:c_index])
if max_volume < stock['volume'][0]:
log = "{:.2f}".format((stock['volume'][0] - max_volume)/max_volume)
return True, log
return False, ""
# 이격도 체크
def check_disparity(self, stock):
if (98 < stock['disparity_avg5'][0] < 102 and 98 < stock['disparity_avg10'][0] < 102 and 98 < stock['disparity_avg20'][0] < 102 and 98 < stock['disparity_avg60'][0] < 102 and 98 < stock['disparity_avg120'][0] < 102):
if stock['close'][1] < stock['avg5'][1] and stock['avg5'][0] < stock['close'][0]:
if stock['stochastic_slow_k'][0] < 20:
if stock['stochastic_slow_k'][1] < stock['stochastic_slow_d'][1] and stock['stochastic_slow_d'][0] < stock['stochastic_slow_k'][0]:
return True
return False
# 낙폭 과대 체크
def check_excessive_drop(self, stock):
c_index = 52 * 5
if len(stock['close']) < c_index:
c_index = len(stock['close'])
for idx in range(1, c_index):
if stock['close'][idx - 1] < int(stock['close'][idx] / 3):
c_index = idx
location = (max(stock['close'][1:c_index]) - stock['close'][0]) / max(
stock['close'][1:c_index])
if location > 0.6:
if stock['stochastic_slow_k'][0] is not None and stock['stochastic_slow_k'][1] is not None and stock['stochastic_slow_d'][1] is not None and stock['stochastic_slow_d'][0] is not None and stock['stochastic_slow_k'][0] is not None:
if stock['stochastic_slow_k'][0] < 20 and (stock['stochastic_slow_k'][1] < stock['stochastic_slow_d'][1] and stock['stochastic_slow_d'][0] < stock['stochastic_slow_k'][0]):
return True
return False
def check_under_EV_Low(self, stock):
if stock['envelope_lower'][0] is not None and stock['envelope_lower'][1] is not None:
# ev 하단에 부딪힘
if stock['close'][1] < stock['avg5'][1] and stock['avg5'][0] < stock['close'][0]:
for c in range(1, 4):
if stock['close'][c] < stock['envelope_lower'][c]:
return True
return False
def check_under_BB_Low(self, stock):
if stock['bolingerband_lower'][0] is not None and stock['bolingerband_lower'][1] is not None:
# bb 하단에 부딪힘
if stock['close'][1] < stock['avg5'][1] and stock['avg5'][0] < stock['close'][0]:
check = False
for c in range(1, 4):
if stock['close'][c] < stock['bolingerband_lower'][c]:
return True
return False