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:
Simon
2026-09-09 07:29:26 +08:00
parent 9cc4bfccac
commit 93e32f4e63
7 changed files with 140 additions and 0 deletions
@@ -60,6 +60,13 @@ class FailoverProvider:
fallback_call=lambda: self.fallback.get_daily(symbol, start, end),
)
def get_index_weight(self, index_code: str) -> list:
return self._with_failover(
"get_index_weight",
primary_call=lambda: self.primary.get_index_weight(index_code),
fallback_call=lambda: self.fallback.get_index_weight(index_code),
)
def get_adjust_factor(self, symbol: str, start: date, end: date) -> list:
return self._with_failover(
"get_adjust_factor",