This commit is contained in:
dsyoon
2024-10-24 23:56:50 +09:00
parent 92b1a5ae0b
commit 2b596544e7

View File

@@ -26,6 +26,8 @@ from stock.analysis.Envelope import Envelope
from stock.analysis.MFI import MFI from stock.analysis.MFI import MFI
from stock.analysis.MovingAverage import MovingAverage from stock.analysis.MovingAverage import MovingAverage
from stock.util.TelegramBot import TelegramBot
class AnalyzerSqlite: class AnalyzerSqlite:
stochastic = None stochastic = None
bolingerBand = None bolingerBand = None
@@ -43,9 +45,11 @@ class AnalyzerSqlite:
analyzedFileName = None analyzedFileName = None
moving_avg = None moving_avg = None
bot = None
def __init__(self, stockFileName=None): def __init__(self, stockFileName=None):
self.common = Common() self.common = Common()
self.bot = TelegramBot()
self.stochastic = Stochastic() self.stochastic = Stochastic()
self.bolingerBand = BolingerBand() self.bolingerBand = BolingerBand()
@@ -476,6 +480,7 @@ class AnalyzerSqlite:
# 후보 찾기 # 후보 찾기
def findCandidates(self, outPath): def findCandidates(self, outPath):
result = []
self.makeDirectory(outPath) self.makeDirectory(outPath)
stockTableName = 'stock' stockTableName = 'stock'
@@ -586,6 +591,12 @@ class AnalyzerSqlite:
dir_name = "daily_5_20" dir_name = "daily_5_20"
log = str(count) + "_" + dir_name + "_" log = str(count) + "_" + dir_name + "_"
self.writeFile(dir_name, CODE, NAME, top, stock_daily, log) self.writeFile(dir_name, CODE, NAME, top, stock_daily, log)
result.append({'ticker_code': CODE, 'ticker_name': NAME,'close': stock_daily['close'][0]})
pStr = '[Stock Analysis]\n'
for item in result:
pStr += " {} {} ({:.2f})\n".format(item['ticker_code'], item['ticker_name'], item['close'])
self.bot.sendMsg(pStr)
return return
def get_moving_average(self, stock): def get_moving_average(self, stock):