From 547a0130c964214ec8d55c811c2bea6d893500f7 Mon Sep 17 00:00:00 2001 From: dsyoon Date: Sat, 11 Sep 2021 14:41:29 +0900 Subject: [PATCH] init --- stockpredictor/analysis/Analyzer.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/stockpredictor/analysis/Analyzer.py b/stockpredictor/analysis/Analyzer.py index b77247c..4131455 100644 --- a/stockpredictor/analysis/Analyzer.py +++ b/stockpredictor/analysis/Analyzer.py @@ -513,18 +513,20 @@ class Analyzer: isbuy = 0 - if stochastic_score < 20 and bolingerband_score < 0.3: - # 위치에너지 < 0.4 and 볼린저밴드 < 0.3 이어야 한다. - if positionalEnergy < 0.2 or bolingerband_score < 0.2: - isbuy = 1 + # 스토케스틱이 20이하이어야 하며, 볼린저밴드 0.3 보다 작으며, 위치에너지도 0.2보다 낮다면, + if stochastic_score < 30 and bolingerband_score < 0.3 and positionalEnergy < 0.3: + isbuy = 1 - # 종가가 240일선 아래에 있으면 매수한다. - if isbuy > 0 and STOCK[last_index]['close'] < STOCK[last_index]['avg240']: + # 위치에너지가 낮거나 240일선 아래에 있는 상태에서 상태값을 갖는 경우 매수한다. + if state != "": isbuy = 2 - # 위치에너지가 낮거나 240일선 아래에 있는 상태에서 상태값을 갖는 경우 매수한다. - if isbuy > 0 and state != "": - isbuy = 3 + # 종가가 240일선 아래라면 매수한다. + if STOCK[last_index]['close'] < STOCK[last_index]['avg240']: + if state == "": + isbuy = 3 + else: + isbuy = 4 if len(STOCK) > 5: # 볼린저밴드 하단에 부딪혔다면, @@ -540,11 +542,14 @@ class Analyzer: # (KOSPI: 2011년 8월 11일) # 오늘 양봉이어야 한다. if STOCK[last_index]['open'] < STOCK[last_index]['close']: - isbuy = 9 + isbuy = 5 # (KOSPI: 2011년 9월 26일) # 오늘 음봉이라면, 오늘 시가는 어제 종가보다 높아야 하고, 오늘 종가는 어제 시가보다 높아야 한다. if (STOCK[last_index]['close'] < STOCK[last_index]['open']) and (STOCK[last_index-1]['close'] < STOCK[last_index]['open'] and STOCK[last_index-1]['open'] < STOCK[last_index]['close']): - isbuy = 9 + isbuy = 5 + + if isbuy==4 and stochastic_score < 30 and bolingerband_score < 0.3 and positionalEnergy < 0.3: + isbuy = 9 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)