add 财报

This commit is contained in:
aaron 2025-05-17 21:11:32 +08:00
parent 8e6f06025c
commit 27348fb2be
3 changed files with 16 additions and 3 deletions

View File

@ -57,6 +57,17 @@ class AStockAPI:
print(f"获取板块失败: {str(e)}")
return pd.DataFrame()
@staticmethod
def get_stock_finance_core_index(stock_code: str) -> pd.DataFrame:
"""
获取核心财务指标
"""
try:
return adata.stock.finance.get_core_index(stock_code)
except Exception as e:
print(f"获取核心财务指标失败: {str(e)}")
return pd.DataFrame()
@staticmethod
def get_stock_shares(stock_code: str) -> pd.DataFrame:
"""

View File

@ -34,6 +34,10 @@ async def get_stock_base(stock_code: str):
result = {}
try:
# 获取核心财务指标
core_index = api.get_stock_finance_core_index(stock_code)
result["finance_core_index"] = json.loads(core_index.to_json(orient="records"))
# 获取股本信息
stock_shares = api.get_stock_shares(stock_code)
result["stock_shares"] = json.loads(stock_shares.to_json(orient="records"))
@ -124,8 +128,6 @@ async def get_stock_data_all(stock_code: str):
@router.post('/{stock_code}/analysis', summary="获取股票分析数据")
async def get_stock_analysis(stock_code: str, current_user: Dict[str, Any] = Depends(get_current_user)):
url = 'https://mate.aimateplus.com/v1/workflows/run'
token = 'app-nWuCOa0YfQVtAosTY3Jr5vFV'
headers = {

View File

@ -29,7 +29,7 @@ services:
cryptoai-api:
build: .
container_name: cryptoai-api
image: cryptoai-api:0.1.2
image: cryptoai-api:0.1.3
restart: always
ports:
- "8000:8000"