refactor: enforce market data quality contracts

This commit is contained in:
leefer
2026-07-29 17:34:21 +08:00
parent 7c8b8ca21e
commit 831291c818
8 changed files with 433 additions and 3 deletions
+32
View File
@@ -0,0 +1,32 @@
# Stage 07: Data Quality and Provenance Gates
Date: 2026-07-29
## Result
- Added a quality rule for every registered data product.
- Added canonical Asia/Shanghai timestamp handling.
- Added source and usage verification before quality acceptance.
- Added maximum-age checks for realtime auction, intraday charts, and realtime indices.
- Added minimum coverage thresholds for deterministic datasets.
- Added unit profiles for prices, shares, currency, percentages, ratios, ranks, and timestamps.
- Added adjustment checks that distinguish current unadjusted deterministic bars from iFinD
forward-adjusted display charts.
- Added announcement-date point-in-time checks for financial data.
- Added explicit provider chains; a display fallback cannot silently become a calculation
source.
- Analyst consensus and Level-2 remain blocked until a qualified provider is registered.
## Fail-Closed Contract
A calculation evidence envelope is rejected when its source is unauthorized, its dataset is
blocked, its timestamp is from the future, its realtime data is stale, its coverage is below
the registered threshold, its units or adjustment mode differ, or its financial record was not
available at the evaluation time.
## Compatibility
Existing legacy provider response shapes remain unchanged in this stage. New governed feature
paths must submit quality evidence through `DataGateway.require_quality`. Existing feature
paths receive envelopes as they migrate behind domain services, avoiding a simultaneous
rewrite of calculations and provider routing.