[2026-05-18] 스케줄러 루프 예외 처리 추가 — Discord 실패 시 봇 종료 버그 수정
This commit is contained in:
+26
-22
@@ -437,31 +437,35 @@ async def run():
|
|||||||
while True:
|
while True:
|
||||||
now = datetime.now().strftime("%H:%M")
|
now = datetime.now().strftime("%H:%M")
|
||||||
|
|
||||||
# 08:30 AI 컨텍스트 로드 + 유니버스 갱신
|
try:
|
||||||
# (claude_morning이 08:15에 시작해 08:30 전에 daily_context.json 생성)
|
# 08:30 AI 컨텍스트 로드 + 유니버스 갱신
|
||||||
if now == "08:30":
|
# (claude_morning이 08:15에 시작해 08:30 전에 daily_context.json 생성)
|
||||||
ctx = bot.strategy.load_ai_context()
|
if now == "08:30":
|
||||||
await notify_ai_result(
|
ctx = bot.strategy.load_ai_context()
|
||||||
ctx["market_sentiment"],
|
await notify_ai_result(
|
||||||
ctx["sentiment_score"],
|
ctx["market_sentiment"],
|
||||||
ctx.get("hot_sectors", []),
|
ctx["sentiment_score"],
|
||||||
ctx.get("avoid_sectors", []),
|
ctx.get("hot_sectors", []),
|
||||||
ctx.get("reason", ""),
|
ctx.get("avoid_sectors", []),
|
||||||
)
|
ctx.get("reason", ""),
|
||||||
bot.risk.set_risk_level(ctx.get("risk_level", "보통"))
|
)
|
||||||
await bot.update_universe()
|
bot.risk.set_risk_level(ctx.get("risk_level", "보통"))
|
||||||
|
await bot.update_universe()
|
||||||
|
|
||||||
# 08:50 목표가 계산
|
# 08:50 목표가 계산
|
||||||
elif now == "08:50":
|
elif now == "08:50":
|
||||||
await bot.calc_targets()
|
await bot.calc_targets()
|
||||||
|
|
||||||
# 09:00 매매 루프 시작
|
# 09:00 매매 루프 시작
|
||||||
elif now == "09:00":
|
elif now == "09:00":
|
||||||
await bot.trading_loop()
|
await bot.trading_loop()
|
||||||
|
|
||||||
# 15:10 결산
|
# 15:10 결산
|
||||||
elif now == "15:10":
|
elif now == "15:10":
|
||||||
await bot.daily_summary()
|
await bot.daily_summary()
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"스케줄러 루프 오류 ({now}): {e}", exc_info=True)
|
||||||
|
|
||||||
await asyncio.sleep(30)
|
await asyncio.sleep(30)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user