From 9cc1cee785b14530d71a46d7f64557e87a969931 Mon Sep 17 00:00:00 2001 From: dosangyoon Date: Sun, 22 Aug 2021 17:04:49 +0900 Subject: [PATCH] init --- stockpredictor/analysis/Analyzer.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/stockpredictor/analysis/Analyzer.py b/stockpredictor/analysis/Analyzer.py index 52c4a2a..b69144d 100644 --- a/stockpredictor/analysis/Analyzer.py +++ b/stockpredictor/analysis/Analyzer.py @@ -374,7 +374,7 @@ class Analyzer: bottom = 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]: break @@ -501,15 +501,28 @@ class Analyzer: else: 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) if stochastic_score < 30 or bolingerband_score < 0.3: if STOCK[last_index]['volume'] > 100000 and STOCK[last_index]['close'] > 1000: # 종목 상태 체크 분석 state, buy_price = self.analyzeFinalScore(last_index, STOCK, STOCHASTIC) - if STOCK[last_index]['close'] < STOCK[last_index]['avg120']: - isbuy = 1 - else: - isbuy = 0 + + isbuy = 0 + # 볼린저밴드 하단에 부딪힌 후 2개의 양봉을 보였으면, 매수한다. + 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) 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)