From 4cdcb62dcfde545645593558f9d4c0f4a69e7595 Mon Sep 17 00:00:00 2001 From: dsyoon Date: Sat, 4 Sep 2021 13:28:02 +0900 Subject: [PATCH] init --- stockpredictor/analysis/Analyzer.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/stockpredictor/analysis/Analyzer.py b/stockpredictor/analysis/Analyzer.py index 3351872..07ac4ba 100644 --- a/stockpredictor/analysis/Analyzer.py +++ b/stockpredictor/analysis/Analyzer.py @@ -506,21 +506,24 @@ class Analyzer: state, buy_price = self.analyzeFinalScore(last_index, STOCK, STOCHASTIC) isbuy = 0 + # 종가가 240일선 아래에 있으면 매수한다. + if isbuy > 0 and STOCK[last_index]['close'] < STOCK[last_index]['avg60']: + isbuy = 1 + + # 위치에너지 < 0.4 and 볼린저밴드 < 0.3 이어야 한다. + if positionalEnergy < 0.3 or bolingerband_score < 0.3: + isbuy = 2 + # 볼린저밴드 하단에 부딪힌 후 2개의 양봉을 보였으면, 매수한다. if len(STOCK) > 5: if STOCK[-1]['open'] < STOCK[-1]['close'] and STOCK[-2]['open'] < STOCK[-2]['close']: if (STOCK[-3]['low'] <= BOLINGERBAND[-3]['lower'] <= STOCK[-3]['high'] or STOCK[-4]['low'] <= BOLINGERBAND[-4]['lower'] <= STOCK[-4]['high'] or STOCK[-5]['low'] <= BOLINGERBAND[-5]['lower'] <= STOCK[-5]['high']): - isbuy = 1 + isbuy = 3 - # 종가가 240일선 아래에 있으면 매수한다. - if isbuy > 0 and STOCK[last_index]['close'] < STOCK[last_index]['avg60']: - isbuy = 2 - - # 위치에너지 < 0.4 and 볼린저밴드 < 0.3 이어야 한다. - if positionalEnergy < 30 or bolingerband_score < 0.3: - isbuy = 0 + if isbuy >= 3 and state != "": + isbuy = 4 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)