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