랭그래프 활용한 주식 정보 도출 프로젝트

- 투자 의견 조회
ㄴ 전반적인 주식 판단 기준(ex. 채무, 리스크 등등)을 기준으로 판단하여 도출
- 투자 추천
ex)
{
  "tickers": [
    "NVDA", "GOOGL", "AAPL"
  ],
  "risk_type": "aggressive"
}
This commit is contained in:
2026-06-19 18:03:05 +09:00
parent 3be7886bfe
commit 315105cebb
19 changed files with 614 additions and 68 deletions
@@ -1,4 +1,4 @@
import yahooquery as yf
import yfinance as yf
from ta.trend import MACD, SMAIndicator
from ta.momentum import RSIIndicator
@@ -10,7 +10,7 @@ async def get_technical_info(ticker: str):
# 주가 데이터 다운로드
df = yf.download(ticker, period="1y", interval="1d")
# 종가 가져오기
close = df['Close'].squeeze()
close = df["Close"].squeeze()
macd = MACD(close)
macd_value = float(macd.macd().iloc[-1])
@@ -18,19 +18,18 @@ async def get_technical_info(ticker: str):
trend = "bullish" if macd_value > signal_value else "bearish"
return {
# 현재 주가
"current_price":close.iloc[-1],
# 20 일선
"sma20":float(SMAIndicator(close, window=20).sma_indicator().iloc[-1]),
# 60 일선
"sma60":float(SMAIndicator(close, window=60).sma_indicator().iloc[-1]),
# 현재주가
"current_price": close.iloc[-1],
# 20일선
"sma20": float(SMAIndicator(close, window=20).sma_indicator().iloc[-1]),
# 60일선
"sma60": float(SMAIndicator(close, window=60).sma_indicator().iloc[-1]),
# rsi
"rsi":float(SMAIndicator(close, window=14).rsi().iloc[-1]),
"rsi": float(RSIIndicator(close, window=14).rsi().iloc[-1]),
# macd
"macd":macd.macd(),
"macd": macd_value,
# macd_signal
"macd_signal": signal_value,
# trend
"trend": trend,
}
"trend": trend,
}