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

- 투자 의견 조회
ㄴ 전반적인 주식 판단 기준(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,5 @@
import yahooquery as yf
import yfinance as yf
# from yahooquery import Ticker
async def get_financial_info(ticker: str):
"""
@@ -7,30 +8,29 @@ async def get_financial_info(ticker: str):
company = yf.Ticker(ticker)
info = company.info
income = company.income_stmtf
income = company.income_stmt
balance = company.balance_sheet
cashflow = company.cash_flow
return {
# 시가 총액
"market_cap":info.get("marketCap"),
# 현재 주가
"current_price":info.get("currentPrice"),
# 시가총액
"market_cap": info.get("marketCap"),
# 현재주가
"current_price": info.get("currentPrice"),
# 매출
"revenue":income.loc["Total Revenue"].iloc[0],
"revenue": income.loc["Total Revenue"].iloc[0],
# 손익계산
"operating_income":income.loc["Operating Income"].iloc[0],
"operating_income": income.loc["Operating Income"].iloc[0],
# 순이익
"net_income":income.loc["Net Income"].iloc[0],
"net_income": income.loc["Net Income"].iloc[0],
# 총자산
"total_assets":balance.loc["Total Assets"].iloc[0],
"total_assets": balance.loc["Total Assets"].iloc[0],
# 총부채
"total_debt":balance.loc["Total Debt"].iloc[0],
"total_debt": balance.loc["Total Debt"].iloc[0],
# 현금흐름
"free_cash_flow":cashflow.loc["Free Cash Flow"].iloc[0],
"free_cash_flow": cashflow.loc["Free Cash Flow"].iloc[0],
# per
"pe_ratio":info.get("trailingPE"),
"pe_ratio": info.get("trailingPE"),
# pbr
"pb_ratio":info.get("priceToBook")
}
"pb_ratio": info.get("priceToBook"),
}