diff --git a/app/main.py b/app/main.py index c9b39c7..e560060 100644 --- a/app/main.py +++ b/app/main.py @@ -428,12 +428,28 @@ async def run(): now = datetime.now().strftime("%H:%M") if "09:00" <= now <= "14:30": - logger.info("장 중 재시작 감지 → 유니버스/목표가 즉시 계산") + logger.info("장 중 재시작 감지 → AI 컨텍스트 로드 + 유니버스/목표가 즉시 계산") + ctx = bot.strategy.load_ai_context() + await notify_ai_result( + ctx["market_sentiment"], + ctx["sentiment_score"], + ctx.get("hot_sectors", []), + ctx.get("avoid_sectors", []), + ctx.get("reason", ""), + ) + bot.risk.set_risk_level(ctx.get("risk_level", "보통")) await bot.update_universe() await bot.calc_targets() await bot.trading_loop() # 바로 매매루프 진입 return + # 08:30 이후~09:00 이전 시작 시 컨텍스트·유니버스 즉시 로드 + if "08:30" <= now < "09:00": + logger.info("장 전 재시작 감지(08:30~09:00) → AI 컨텍스트 로드 + 유니버스 즉시 갱신") + ctx = bot.strategy.load_ai_context() + bot.risk.set_risk_level(ctx.get("risk_level", "보통")) + await bot.update_universe() + while True: now = datetime.now().strftime("%H:%M")