1
This commit is contained in:
parent
f21c4039f7
commit
e3a4cd281a
@ -57,14 +57,16 @@ async def get_stock_base(stock_code: str):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
@router.get("/stock/data", summary="获取股票数据")
|
@router.get("/stock/data", summary="获取股票数据")
|
||||||
async def get_stock_data(stock_code: str):
|
async def get_stock_data(stock_code: str, start_date: Optional[str] = None, end_date: Optional[str] = None):
|
||||||
api = AStockAPI()
|
api = AStockAPI()
|
||||||
|
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
start_date = "2025-01-01"
|
if start_date is None:
|
||||||
end_date = datetime.now().strftime("%Y-%m-%d")
|
start_date = "2025-01-01"
|
||||||
|
if end_date is None:
|
||||||
|
end_date = datetime.now().strftime("%Y-%m-%d")
|
||||||
|
|
||||||
# 获取市场数据
|
# 获取市场数据
|
||||||
market_data = api.get_market_data(stock_code, start_date, end_date)
|
market_data = api.get_market_data(stock_code, start_date, end_date)
|
||||||
|
|||||||
@ -29,7 +29,7 @@ services:
|
|||||||
cryptoai-api:
|
cryptoai-api:
|
||||||
build: .
|
build: .
|
||||||
container_name: cryptoai-api
|
container_name: cryptoai-api
|
||||||
image: cryptoai-api:0.1.4
|
image: cryptoai-api:0.1.5
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user