mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 18:04:20 +08:00
- 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)
17 lines
415 B
Python
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)
|