This commit is contained in:
aaron 2025-05-13 00:14:18 +08:00
parent 6848f78fac
commit ad6481998d
3 changed files with 14 additions and 3 deletions

View File

@ -96,7 +96,18 @@ class AStockAPI:
except Exception as e: except Exception as e:
print(f"获取分钟线数据失败: {str(e)}") print(f"获取分钟线数据失败: {str(e)}")
return pd.DataFrame() return pd.DataFrame()
@staticmethod
def get_capital_flow(stock_code: str) -> pd.DataFrame:
"""
获取股票资金流向数据
"""
try:
return adata.stock.market.get_capital_flow(stock_code=stock_code)
except Exception as e:
print(f"获取资金流向数据失败: {str(e)}")
return pd.DataFrame()
@staticmethod @staticmethod
def get_capital_flow_min(stock_code: str) -> pd.DataFrame: def get_capital_flow_min(stock_code: str) -> pd.DataFrame:
""" """

View File

@ -35,7 +35,7 @@ async def get_stock_data(stock_code: str):
# result["min_data"] = json.loads(min_data.to_json(orient="records")) # result["min_data"] = json.loads(min_data.to_json(orient="records"))
# 获取资金流向数据 # 获取资金流向数据
flow_data = api.get_capital_flow_min(stock_code) flow_data = api.get_capital_flow(stock_code)
result["flow_data"] = json.loads(flow_data.to_json(orient="records")) result["flow_data"] = json.loads(flow_data.to_json(orient="records"))
return result return result

View File

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