fix(agent-office): EOD 16:50 stagger(부분일봉 방지)·idle가드 문서화·proxy/import 정리
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -337,7 +337,8 @@ class StockAgent(BaseAgent):
|
|||||||
await self.transition("idle", "AI 뉴스 완료")
|
await self.transition("idle", "AI 뉴스 완료")
|
||||||
|
|
||||||
async def run_holdings_eod(self) -> dict:
|
async def run_holdings_eod(self) -> dict:
|
||||||
"""평일 16:40 — 보유종목 시그널 계산·저장."""
|
"""평일 16:50 — 보유종목 시그널 계산·저장."""
|
||||||
|
# idle 가드 없음(의도적): 스크리너 진행 중에도 EOD/브리핑은 독립적으로 실행되어야 함
|
||||||
from ..service_proxy import stock_holdings_run
|
from ..service_proxy import stock_holdings_run
|
||||||
from ..db import create_task, update_task_status, add_log
|
from ..db import create_task, update_task_status, add_log
|
||||||
task_id = create_task(self.agent_id, "holdings_eod", {})
|
task_id = create_task(self.agent_id, "holdings_eod", {})
|
||||||
@@ -353,6 +354,7 @@ class StockAgent(BaseAgent):
|
|||||||
|
|
||||||
async def run_holdings_brief(self) -> dict:
|
async def run_holdings_brief(self) -> dict:
|
||||||
"""평일 08:30 — 저장된 시그널 브리핑 텔레그램."""
|
"""평일 08:30 — 저장된 시그널 브리핑 텔레그램."""
|
||||||
|
# idle 가드 없음(의도적): 스크리너 진행 중에도 EOD/브리핑은 독립적으로 실행되어야 함
|
||||||
from ..service_proxy import stock_holdings_brief
|
from ..service_proxy import stock_holdings_brief
|
||||||
from ..notifiers.telegram_stock import send_holdings_brief
|
from ..notifiers.telegram_stock import send_holdings_brief
|
||||||
from ..db import create_task, update_task_status, add_log
|
from ..db import create_task, update_task_status, add_log
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
|
from ..telegram.messaging import send_raw
|
||||||
|
|
||||||
logger = logging.getLogger("agent-office")
|
logger = logging.getLogger("agent-office")
|
||||||
|
|
||||||
_ACTION_KR = {"add": "🟢 추가매수", "hold": "⚪ 보유", "trim": "🟡 축소", "sell": "🔴 매도"}
|
_ACTION_KR = {"add": "🟢 추가매수", "hold": "⚪ 보유", "trim": "🟡 축소", "sell": "🔴 매도"}
|
||||||
@@ -33,7 +35,6 @@ def format_holdings_brief(payload: Dict[str, Any]) -> str:
|
|||||||
|
|
||||||
|
|
||||||
async def send_holdings_brief(payload: Dict[str, Any]) -> None:
|
async def send_holdings_brief(payload: Dict[str, Any]) -> None:
|
||||||
from ..telegram.messaging import send_raw
|
|
||||||
text = format_holdings_brief(payload)
|
text = format_holdings_brief(payload)
|
||||||
try:
|
try:
|
||||||
await send_raw(text)
|
await send_raw(text)
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ def init_scheduler():
|
|||||||
minute=0,
|
minute=0,
|
||||||
id="stock_ai_news_sentiment",
|
id="stock_ai_news_sentiment",
|
||||||
)
|
)
|
||||||
scheduler.add_job(_run_stock_holdings_eod, "cron", day_of_week="mon-fri", hour=16, minute=40, id="stock_holdings_eod")
|
scheduler.add_job(_run_stock_holdings_eod, "cron", day_of_week="mon-fri", hour=16, minute=50, id="stock_holdings_eod") # 16:50: 스크리너 snapshot(16:30) 완료 후 — 부분 일봉 읽기 방지
|
||||||
scheduler.add_job(_run_stock_holdings_brief, "cron", day_of_week="mon-fri", hour=8, minute=30, id="stock_holdings_brief")
|
scheduler.add_job(_run_stock_holdings_brief, "cron", day_of_week="mon-fri", hour=8, minute=30, id="stock_holdings_brief")
|
||||||
scheduler.add_job(_run_insta_schedule, "cron", hour=9, minute=30, id="insta_pipeline")
|
scheduler.add_job(_run_insta_schedule, "cron", hour=9, minute=30, id="insta_pipeline")
|
||||||
# 외부 트렌드 수집은 장 마감 후 16:40 — 9시 주식 활발 시간대 NAS 자원 회피.
|
# 외부 트렌드 수집은 장 마감 후 16:40 — 9시 주식 활발 시간대 NAS 자원 회피.
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ async def stock_holdings_brief() -> Dict[str, Any]:
|
|||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
return resp.json()
|
return resp.json()
|
||||||
|
|
||||||
|
|
||||||
async def generate_music(payload: dict) -> Dict[str, Any]:
|
async def generate_music(payload: dict) -> Dict[str, Any]:
|
||||||
resp = await _client.post(f"{MUSIC_LAB_URL}/api/music/generate", json=payload)
|
resp = await _client.post(f"{MUSIC_LAB_URL}/api/music/generate", json=payload)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
|
|||||||
Reference in New Issue
Block a user