315105cebb
- 투자 의견 조회
ㄴ 전반적인 주식 판단 기준(ex. 채무, 리스크 등등)을 기준으로 판단하여 도출
- 투자 추천
ex)
{
"tickers": [
"NVDA", "GOOGL", "AAPL"
],
"risk_type": "aggressive"
}
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
import yfinance as yf
|
|
|
|
COMPETITOR_MAP = {
|
|
"NVDA": ["AMD", "INTC", "TSM", "AVGO"],
|
|
"AMD": ["NVDA", "INTC", "TSM"],
|
|
"TSLA": ["RIVN", "GM", "F"],
|
|
"AAPL": ["MSFT", "GOOGL", "AMZN"],
|
|
"MSFT": ["AAPL", "GOOGL", "AMZN"],
|
|
"GOOGL": ["MSFT", "META", "AMZN"],
|
|
}
|
|
|
|
async def get_competitor_info(ticker: str):
|
|
"""
|
|
경쟁 관계 회사에 대한 핵심 정보 추출
|
|
"""
|
|
competitors_tickers = COMPETITOR_MAP.get(ticker, [])
|
|
|
|
results =[]
|
|
for comp in competitors_tickers:
|
|
company = yf.Ticker(comp)
|
|
info = company.info
|
|
|
|
results.append(
|
|
{
|
|
#
|
|
"ticker": comp,
|
|
# 회사 이름
|
|
"company_name": info.get("longName"),
|
|
# 시가총액
|
|
"market_cap": info.get("marketCap"),
|
|
# per
|
|
"pe_ratio": info.get("pe_ratio"),
|
|
# 매출 성장률
|
|
"revenue_growth": info.get("revenue_growth"),
|
|
# 순 이익률
|
|
"profit_margin": info.get("profitMargins"),
|
|
}
|
|
)
|
|
|
|
return results
|
|
|