add 财报
This commit is contained in:
parent
8e6f06025c
commit
27348fb2be
@ -57,6 +57,17 @@ class AStockAPI:
|
|||||||
print(f"获取板块失败: {str(e)}")
|
print(f"获取板块失败: {str(e)}")
|
||||||
return pd.DataFrame()
|
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
|
@staticmethod
|
||||||
def get_stock_shares(stock_code: str) -> pd.DataFrame:
|
def get_stock_shares(stock_code: str) -> pd.DataFrame:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -34,6 +34,10 @@ async def get_stock_base(stock_code: str):
|
|||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
try:
|
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)
|
stock_shares = api.get_stock_shares(stock_code)
|
||||||
result["stock_shares"] = json.loads(stock_shares.to_json(orient="records"))
|
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="获取股票分析数据")
|
@router.post('/{stock_code}/analysis', summary="获取股票分析数据")
|
||||||
async def get_stock_analysis(stock_code: str, current_user: Dict[str, Any] = Depends(get_current_user)):
|
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'
|
url = 'https://mate.aimateplus.com/v1/workflows/run'
|
||||||
token = 'app-nWuCOa0YfQVtAosTY3Jr5vFV'
|
token = 'app-nWuCOa0YfQVtAosTY3Jr5vFV'
|
||||||
headers = {
|
headers = {
|
||||||
|
|||||||
@ -29,7 +29,7 @@ services:
|
|||||||
cryptoai-api:
|
cryptoai-api:
|
||||||
build: .
|
build: .
|
||||||
container_name: cryptoai-api
|
container_name: cryptoai-api
|
||||||
image: cryptoai-api:0.1.2
|
image: cryptoai-api:0.1.3
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user