Files
easy_tdx_max/src/easy_tdx/web/deps.py
T
Justin Gu eb8a7a5675 feat(web): add FastAPI app factory, all routers, CLI serve command, and tests
- App factory with lifespan management and CORS middleware
- Market router: security list, quotes, market stat, fund-flow
- Bars router: kline, index kline, minute, transaction
- Finance router: xdxr, finance, company info, financial records
- Block router: block file parsing
- Chanlun router: POST /chanlun/analyze
- Realtime router: WebSocket /ws/realtime/{symbol}
- CLI: easy-tdx serve command
- 16 unit tests, all passing offline (no network)
2026-06-12 03:08:12 +08:00

17 lines
415 B
Python

"""Dependency injection for Web API routers."""
from __future__ import annotations
import typing
from typing import TYPE_CHECKING
from fastapi import Request
if TYPE_CHECKING:
from easy_tdx.client import AsyncTdxClient
def get_client(request: Request) -> AsyncTdxClient:
"""从 app.state 获取共享的 AsyncTdxClient 实例。"""
return typing.cast(AsyncTdxClient, request.app.state.tdx_client)