feat(data): B1-2 指数成分同步(Provider + CLI sync index_weight)
- MarketDataProvider.get_index_weight(协议);Tushare 实现 normalize_index_weight + get_index_weight(ts_code=... 全历史成分权重);Sina 抛 DataSourceNotSupported; FailoverProvider 代理并审计每次尝试 - CLI:sync index_weight --code 000300.SH(拉取→幂等落库 index_weight→打印最新快照; 失败走 sync_log 审计并返回非零) - tests:Tushare 映射与调用(FakePro)、Failover 主源单源语义(新浪不支持被审计); 全量 pytest 通过
This commit is contained in:
@@ -9,6 +9,7 @@ from __future__ import annotations
|
||||
from datetime import date
|
||||
from typing import Protocol
|
||||
|
||||
from app.domain.entities.index import IndexWeight
|
||||
from app.domain.entities.market import (
|
||||
AdjustFactor,
|
||||
DailyBar,
|
||||
@@ -49,3 +50,9 @@ class MarketDataProvider(Protocol):
|
||||
start_date/end_date 参数,按报告期过滤);不传表示全量历史。
|
||||
新浪接口不支持按窗口拉取,提供方会忽略窗口后由调用方自行过滤。
|
||||
"""
|
||||
|
||||
def get_index_weight(self, index_code: str) -> list[IndexWeight]:
|
||||
"""指数历史成分(含权重):每期成分快照 → IndexWeight(index_code, trade_date, symbol)。
|
||||
|
||||
供 index_weight 同步与历史成分 Universe(v3 §9)。"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user