Files
Source/project/STOCK_APP/backend/graph/stock_graph.py
T
cooney 315105cebb 랭그래프 활용한 주식 정보 도출 프로젝트
- 투자 의견 조회
ㄴ 전반적인 주식 판단 기준(ex. 채무, 리스크 등등)을 기준으로 판단하여 도출
- 투자 추천
ex)
{
  "tickers": [
    "NVDA", "GOOGL", "AAPL"
  ],
  "risk_type": "aggressive"
}
2026-06-19 18:03:05 +09:00

30 lines
988 B
Python

from langgraph.graph import StateGraph, START, END
from backend.graph.state import StockAnalysisState
from backend.graph.nodes import news_node, financial_node, competitor_node, report_node, technical_node
import logging
logger = logging.getLogger(__name__)
def build_stock_graph():
# 그래프 생성
graph = StateGraph(StockAnalysisState)
# 노드 등록
graph.add_node("news", news_node)
graph.add_node("financial", financial_node)
graph.add_node("technical", technical_node)
graph.add_node("competitors", competitor_node)
graph.add_node("report", report_node)
# 연결
graph.add_edge(START, "news")
graph.add_edge("news", "financial")
graph.add_edge("financial", "technical")
graph.add_edge("technical", "competitors")
graph.add_edge("competitors", "report")
graph.add_edge("report", END)
# 실행
compiled = graph.compile()
logger.info("LangGraph 주식 분석 그래프 빌드 완료")
return compiled