refactor: route market providers through data gateway

This commit is contained in:
leefer
2026-07-29 17:25:21 +08:00
parent 3994387935
commit 7c8b8ca21e
12 changed files with 318 additions and 30 deletions
+2 -2
View File
@@ -265,8 +265,8 @@
},
{
"path": "server.py",
"bytes": 267525,
"lines": 5938
"bytes": 267835,
"lines": 5947
},
{
"path": "static/redesign-v2.css",
+29
View File
@@ -0,0 +1,29 @@
# Stage 06: Unified Data Gateway
Date: 2026-07-29
## Result
- Added canonical provider and dataset contracts under `backend/data`.
- Added `DataSourcePolicy`, loaded from the Stage 04 data registry.
- Added provider adapters for Tushare and iFinD.
- Added one `DataGateway` that owns Tushare creation, the shared iFinD client, chart routing,
and isolated Eastmoney/Tencent realtime observation.
- Replaced all real `DashboardService` Tushare construction paths with the gateway.
- Kept one compatibility constructor for unit tests that instantiate an incomplete service with
`__new__`; production instances never use it.
- The Tushare token is supplied lazily, so administrator credential changes do not leave a
stale client in memory.
## Enforcement Introduced
- Unregistered datasets fail.
- Blocked datasets fail.
- Public-web providers cannot be promoted to calculation inputs through a fallback call.
- Display chart fallbacks remain distinct from deterministic calculation datasets.
## Deferred to Stage 07
Stage 06 centralizes provider access but does not yet attach freshness, coverage, unit, and
point-in-time quality evidence to every returned observation. Stage 07 introduces those gates
without changing provider routing again.