diff --git a/AnalyzerSqlite.py b/AnalyzerSqlite.py index d075ba1..84c478c 100644 --- a/AnalyzerSqlite.py +++ b/AnalyzerSqlite.py @@ -482,7 +482,10 @@ class AnalyzerSqlite: # 후보 찾기 def findCandidates(self, outPath): - result = [] + result_3_5 = [] + result_5_20 = [] + result_ichimok = [] + self.makeDirectory(outPath) stockTableName = 'stock' @@ -593,7 +596,7 @@ class AnalyzerSqlite: dir_name = "daily_5_20" log = str(count) + "_" + dir_name + "_" self.writeFile(dir_name, CODE, NAME, top, stock_daily, log) - result.append({'ticker_code': CODE, 'ticker_name': NAME,'close': stock_daily['close'][0], 'type': '5~20'}) + result_5_20.append({'ticker_code': CODE, 'ticker_name': NAME,'close': stock_daily['close'][0], 'type': '5~20'}) check = self.common.buy_stock_daily_3_5(stock_daily) if check: @@ -601,7 +604,7 @@ class AnalyzerSqlite: dir_name = "daily_3_5" log = str(count) + "_" + dir_name + "_" self.writeFile(dir_name, CODE, NAME, top, stock_daily, log) - result.append({'ticker_code': CODE, 'ticker_name': NAME,'close': stock_daily['close'][0], 'type': '3~5'}) + result_3_5.append({'ticker_code': CODE, 'ticker_name': NAME,'close': stock_daily['close'][0], 'type': '3~5'}) check = self.common.buy_stock_ichimok(stock_daily) if check: @@ -609,12 +612,12 @@ class AnalyzerSqlite: dir_name = "daily_ichimok" log = str(count) + "_" + dir_name + "_" self.writeFile(dir_name, CODE, NAME, top, stock_daily, log) - result.append({'ticker_code': CODE, 'ticker_name': NAME,'close': stock_daily['close'][0], 'type': 'ichimok'}) + result_ichimok.append({'ticker_code': CODE, 'ticker_name': NAME,'close': stock_daily['close'][0], 'type': 'ichimok'}) pStr = '[Stock Analysis]\n' i = 0 - for item in result: + for item in result_3_5: pStr += " <{}> {} {} ({:.2f})\n".format(item['type'], item['ticker_code'], item['ticker_name'], item['close']) i += 1 if i==100: @@ -623,6 +626,28 @@ class AnalyzerSqlite: pStr = '' if i>0: self.bot.sendMsg(pStr) + + i = 0 + for item in result_5_20: + pStr += " <{}> {} {} ({:.2f})\n".format(item['type'], item['ticker_code'], item['ticker_name'], item['close']) + i += 1 + if i == 100: + i = 0 + self.bot.sendMsg(pStr) + pStr = '' + if i > 0: + self.bot.sendMsg(pStr) + + i = 0 + for item in result_ichimok: + pStr += " <{}> {} {} ({:.2f})\n".format(item['type'], item['ticker_code'], item['ticker_name'], item['close']) + i += 1 + if i == 100: + i = 0 + self.bot.sendMsg(pStr) + pStr = '' + if i > 0: + self.bot.sendMsg(pStr) return def get_moving_average(self, stock):