"""交易服务健康检查路由""" from fastapi import APIRouter, Depends from app.shared.api import ApiResponse, get_container from app.trading.container import TradingContainer from app.trading.models import TradingHealthData router = APIRouter(tags=["health"]) @router.get("/health", response_model=ApiResponse[TradingHealthData]) async def health( container: TradingContainer = Depends(get_container), ) -> ApiResponse[TradingHealthData]: """交易服务健康状态 auth 给出两站账号登录态。这里只读缓存、不触发网络探测,避免健康检查被 上游高频轮询时反复打站点;要实时结果请用 POST /api/auth/status。 注意 `logged_in=null` 表示服务启动后还没探测过,不等于未登录。 """ return ApiResponse[TradingHealthData]( success=True, msg="success", data=TradingHealthData(status="ok", auth=container.auth_session.status_all()), code=0, )