This commit is contained in:
dsyoon
2023-09-02 20:43:40 +09:00
parent d9343af937
commit 91e670b533

View File

@@ -136,6 +136,8 @@ if week in (0, 1, 2, 3, 4): # 0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일
stockCrawler = StockCrawler(START_DATE)
print("\n[국내 ETF 수집]")
stockCrawler.crawl_etf_stocks(stockFileName)
slackBot.sendMsg("7. done etf stocks...")
@@ -147,6 +149,7 @@ if week in (0, 1, 2, 3, 4): # 0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일
slackBot.sendMsg("8. done stocks...")
print("\n[US 종목 수집]")
stockCrawler.crawl_special_stocks(stockFileName)
slackBot.sendMsg("9. done US stocks...")
@@ -156,52 +159,36 @@ if week in (0, 1, 2, 3, 4): # 0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일
inFileName = PROJECT_HOME + '/resources/stock.db'
analyzerSqlite = AnalyzerSqlite(stockFileName)
ERROR_COUNT = 0
while ERROR_COUNT < 3:
try:
print("\n[종목 분석]")
# S: 분석까지 진행
analyzerSqlite.analyzeDaily()
analyzerSqlite.analyzeGrouping("weekly")
analyzerSqlite.analyzeGrouping("monthly")
slackBot.sendMsg("10. analyze...")
break
except:
ERROR_COUNT += 1
continue
if ERROR_COUNT >= 3:
exit()
print("\n[종목 분석]")
# S: 분석까지 진행
analyzerSqlite.analyzeDaily()
analyzerSqlite.analyzeGrouping("weekly")
analyzerSqlite.analyzeGrouping("monthly")
slackBot.sendMsg("10. analyze...")
ERROR_COUNT = 0
while ERROR_COUNT < 3:
try:
print("\n[종목 결정]")
# HTML 출력
outPath = os.path.join(PROJECT_HOME, "resources", "analysis")
if not os.path.isdir(outPath):
os.mkdir(outPath)
day = datetime.today().strftime("%Y%m%d")
before_7_day = datetime.today() + relativedelta(days=-7)
dayList = os.listdir(outPath)
for dayDir in dayList:
if dayDir[0] != '.' and dayDir < before_7_day.strftime("%Y%m%d"):
if os.path.exists(os.path.join(outPath, dayDir)) and os.path.isdir(os.path.join(outPath, dayDir)):
shutil.rmtree(os.path.join(outPath, dayDir))
outPath = os.path.join(outPath, day)
if os.path.isdir(outPath):
shutil.rmtree(outPath)
os.mkdir(outPath)
print("\n[종목 결정]")
# HTML 출력
outPath = os.path.join(PROJECT_HOME, "resources", "analysis")
if not os.path.isdir(outPath):
os.mkdir(outPath)
day = datetime.today().strftime("%Y%m%d")
before_7_day = datetime.today() + relativedelta(days=-7)
dayList = os.listdir(outPath)
for dayDir in dayList:
if dayDir[0] != '.' and dayDir < before_7_day.strftime("%Y%m%d"):
if os.path.exists(os.path.join(outPath, dayDir)) and os.path.isdir(os.path.join(outPath, dayDir)):
shutil.rmtree(os.path.join(outPath, dayDir))
outPath = os.path.join(outPath, day)
if os.path.isdir(outPath):
shutil.rmtree(outPath)
os.mkdir(outPath)
analyzerSqlite.findCandidates(outPath)
slackBot.sendMsg("11. done decision...")
analyzerSqlite.findCandidates(outPath)
slackBot.sendMsg("11. done decision...")
break
except:
ERROR_COUNT += 1
continue
if ERROR_COUNT >= 3:
exit()