feat(stock): /api/stock/trade-alerts 응답에 조건별 근거(reason) 문자열 추가

FE가 detail(객체)을 그대로 렌더해 React #31 크래시 → 안전한 텍스트 필드 제공.
condition_reason(조건→한줄근거), agent-office telegram_trade._COND_REASON과 동일 유지.
This commit is contained in:
2026-07-09 12:47:34 +09:00
parent 9baea3a0e2
commit b8229c0ffa
3 changed files with 34 additions and 2 deletions

View File

@@ -775,8 +775,11 @@ def delete_watchlist_item(ticker: str):
@app.get("/api/stock/trade-alerts")
def list_trade_alerts(days: int = 7):
"""매매 알람 이력 조회 (최근 N일)"""
return {"alerts": get_alert_history(days)}
"""매매 알람 이력 조회 (최근 N일). 조건별 근거(reason) 문자열 포함 — FE가 detail 객체 대신 렌더."""
alerts = get_alert_history(days)
for a in alerts:
a["reason"] = trade_alerts.condition_reason(a.get("condition", ""))
return {"alerts": alerts}
# --- Holdings Intelligence API ---