This commit is contained in:
dsyoon
2023-02-06 22:27:45 +09:00
parent 6af08b0f52
commit c3156e9f25
2 changed files with 19 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ from stock.crawler.FnGuideCrawler import FnGuideCrawler
from stock.crawler.MetaCrawler import MetaCrawler from stock.crawler.MetaCrawler import MetaCrawler
from stock.crawler.StockCrawler import StockCrawler from stock.crawler.StockCrawler import StockCrawler
from stock.analysis.AnalyzerSqlite import AnalyzerSqlite from stock.analysis.AnalyzerSqlite import AnalyzerSqlite
from stock.util.SlackBot import SlackBot
today = datetime.now().strftime("%Y-%m-%d") today = datetime.now().strftime("%Y-%m-%d")
@@ -21,6 +22,8 @@ stockFileName = os.path.join(RESOURCE_PATH, 'stock.db')
week = datetime.today().weekday() week = datetime.today().weekday()
slackBot = SlackBot()
if week in (0, 1, 2, 3, 4): # 0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일 if week in (0, 1, 2, 3, 4): # 0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일
# 재무제표는 3개월마다 다운로드를 한다. # 재무제표는 3개월마다 다운로드를 한다.
@@ -81,6 +84,7 @@ if week in (0, 1, 2, 3, 4): # 0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일
analyzerSqlite.findCandidate(outPath) analyzerSqlite.findCandidate(outPath)
slackBot.sendMsg("Done. Crawling...")
print("time : %6.2f", (time.time() - start)) print("time : %6.2f", (time.time() - start))
print ("done...") print ("done...")

View File

@@ -32,6 +32,21 @@ class SlackBot:
return return
def sendMsg(self, msg):
try:
this_time = datetime.now()
text = "DATE TIME:" + this_time.strftime('%Y-%m-%d %H:%M:%S') + ", " + "msg:" + msg
result = self.client.chat_postMessage(
channel=self.CHANNEL_ID,
text=text
)
print(text)
except SlackApiError as e:
print(f"Error posting message: {e}")
return
if __name__ == "__main__": if __name__ == "__main__":
this_time = datetime.now() this_time = datetime.now()