diff --git a/stockpredictor/analysis/Analyzer.py b/stockpredictor/analysis/Analyzer.py index 3157d21..7f56df3 100644 --- a/stockpredictor/analysis/Analyzer.py +++ b/stockpredictor/analysis/Analyzer.py @@ -389,34 +389,34 @@ class Analyzer: return round(energy, 2) - def writeFile(self, fig, state, bolingerband_score, stochastic_score, positionalEnergy, item_name, item_code): + def writeFile(self, fig, state, isbuy, buy_price, bolingerband_score, stochastic_score, positionalEnergy, item_name, item_code): count = 0 if bolingerband_score < 0.15: fileName = self.bolingerband_path - fileName = "%s/b(%.2f)__p(%.2f)__s(%.2f)__%s__%s_%s.html" % (fileName, bolingerband_score, positionalEnergy, stochastic_score, state, item_name.replace(" ", ""), item_code) + fileName = "%s/%d__b(%.2f)__p(%.2f)__s(%.2f)__%s__%d__%s_%s.html" % (fileName, isbuy, bolingerband_score, positionalEnergy, stochastic_score, state, buy_price, item_name.replace(" ", ""), item_code) po.write_html(fig, file=fileName, auto_open=False) count += 1 if stochastic_score < 15: fileName = self.stochastic_path - fileName = "%s/s(%.2f)__b(%.2f)__p(%.2f)__%s__%s_%s.html" % (fileName, stochastic_score, bolingerband_score, positionalEnergy, state, item_name.replace(" ", ""), item_code) + fileName = "%s/%d__s(%.2f)__b(%.2f)__p(%.2f)__%s__%d__%s_%s.html" % (fileName, isbuy, stochastic_score, bolingerband_score, positionalEnergy, state, buy_price, item_name.replace(" ", ""), item_code) po.write_html(fig, file=fileName, auto_open=False) if positionalEnergy < 0.15: fileName = self.positionalEnergy_path - fileName = "%s/p(%.2f)__b(%.2f)__s(%.2f)__%s__%s_%s.html" % (fileName, positionalEnergy, bolingerband_score, stochastic_score, state, item_name.replace(" ", ""), item_code) + fileName = "%s/%d__p(%.2f)__b(%.2f)__s(%.2f)__%s__%d__%s_%s.html" % (fileName, isbuy, positionalEnergy, bolingerband_score, stochastic_score, state, buy_price, item_name.replace(" ", ""), item_code) po.write_html(fig, file=fileName, auto_open=False) count += 1 if count > 1: fileName = self.outPath - fileName = "%s/p(%.2f)__b(%.2f)__s(%.2f)__%s__%s_%s.html" % (fileName, positionalEnergy, bolingerband_score, stochastic_score, state, item_name.replace(" ", ""), item_code) + fileName = "%s/%d__p(%.2f)__b(%.2f)__s(%.2f)__%s__%d__%s_%s.html" % (fileName, isbuy, positionalEnergy, bolingerband_score, stochastic_score, state, buy_price, item_name.replace(" ", ""), item_code) po.write_html(fig, file=fileName, auto_open=False) if state != "": fileName = self.outPath - fileName = "%s/%s__p(%.2f)__b(%.2f)__s(%.2f)__%s_%s.html" % (fileName, state, positionalEnergy, bolingerband_score, stochastic_score, item_name.replace(" ", ""), item_code) + fileName = "%s/%d__%s__p(%.2f)__b(%.2f)__s(%.2f)__%d__%s_%s.html" % (fileName, isbuy, state, positionalEnergy, bolingerband_score, stochastic_score, buy_price, item_name.replace(" ", ""), item_code) po.write_html(fig, file=fileName, auto_open=False) return @@ -499,12 +499,16 @@ class Analyzer: 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 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) fig['layout'].update(title=title) - self.writeFile(fig, state, bolingerband_score, stochastic_score, positionalEnergy, item_name, item_code) + self.writeFile(fig, state, isbuy, buy_price, bolingerband_score, stochastic_score, positionalEnergy, item_name, item_code) rowid += 1 cursor.execute('SELECT * FROM ' + self.tableName + ' WHERE rowid=?', (rowid,))