This commit is contained in:
dosangyoon
2021-08-22 17:04:49 +09:00
parent a32463e19a
commit 9cc1cee785

View File

@@ -374,7 +374,7 @@ class Analyzer:
bottom = stock[i]['close'] bottom = stock[i]['close']
price = stock[i]['close'] price = stock[i]['close']
for i in range(180, 540): for i in range(8, 540):
if i > len(stock) or not stock[-i]: if i > len(stock) or not stock[-i]:
break break
@@ -501,15 +501,28 @@ class Analyzer:
else: else:
bolingerband_score = round(((STOCK[last_index]['close']-BOLINGERBAND[last_index]['lower'])/(BOLINGERBAND[last_index]['upper']-BOLINGERBAND[last_index]['lower'])), 2) bolingerband_score = round(((STOCK[last_index]['close']-BOLINGERBAND[last_index]['lower'])/(BOLINGERBAND[last_index]['upper']-BOLINGERBAND[last_index]['lower'])), 2)
# 위치 에너지
positionalEnergy = self.getPositionalEnergy(STOCK, last_index) positionalEnergy = self.getPositionalEnergy(STOCK, last_index)
if stochastic_score < 30 or bolingerband_score < 0.3: if stochastic_score < 30 or bolingerband_score < 0.3:
if STOCK[last_index]['volume'] > 100000 and STOCK[last_index]['close'] > 1000: if STOCK[last_index]['volume'] > 100000 and STOCK[last_index]['close'] > 1000:
# 종목 상태 체크 분석 # 종목 상태 체크 분석
state, buy_price = self.analyzeFinalScore(last_index, STOCK, STOCHASTIC) state, buy_price = self.analyzeFinalScore(last_index, STOCK, STOCHASTIC)
if STOCK[last_index]['close'] < STOCK[last_index]['avg120']:
isbuy = 1 isbuy = 0
else: # 볼린저밴드 하단에 부딪힌 후 2개의 양봉을 보였으면, 매수한다.
isbuy = 0 count = 0
if len(STOCK) > 3 and STOCK[-1]['open'] < STOCK[-1]['close']:
for idx in range(2, 5):
if STOCK[-idx]['open'] < STOCK[-idx]['close']:
count += 1
if count > 1:
if (BOLINGERBAND[last_index]['lower'] < STOCK[-3]['close'] < BOLINGERBAND[last_index]['upper'] or BOLINGERBAND[last_index]['lower'] < STOCK[-4]['close'] < BOLINGERBAND[last_index]['upper']):
isbuy = 1
# 종가가 120일선 아래에 있으면 매수한다.
#if STOCK[last_index]['close'] < STOCK[last_index]['avg120']:
# isbuy = 1
#else:
# isbuy = 0
fig = self.draw(stock) fig = self.draw(stock)
title = "%s (%s), %s, buy_price (%d), stochastic(%.2f), bolingerband(%.2f), positionalEnergy(%.2f) 차트" % (item_name, item_code, state, buy_price, stochastic_score, bolingerband_score, positionalEnergy) title = "%s (%s), %s, buy_price (%d), stochastic(%.2f), bolingerband(%.2f), positionalEnergy(%.2f) 차트" % (item_name, item_code, state, buy_price, stochastic_score, bolingerband_score, positionalEnergy)