refactor(quant): M7.2a Composite Engine 模块化(quant/composite.py)

- cross_sectional_zscore / composite_score / build_factor_panels 从 local_engine 迁入
  quant/composite.py;新增统一入口 build_score_panel(daily, factor_specs)
- local_engine re-export 保持旧引用兼容;selection/engine 的评分面板构建均指向
  composite —— 选股与回测的复合分实现收敛于一处
- 回归:quant/eval/research/selection 一致性/qlib 引擎测试全过;全量 pytest 通过
This commit is contained in:
Simon
2026-09-09 00:29:23 +08:00
parent 8f47b5b603
commit 273aee2772
4 changed files with 83 additions and 57 deletions
+2 -3
View File
@@ -21,8 +21,8 @@ from app.domain.entities.selection import (
SelectionResult,
SelectionStatistics,
)
from app.quant.composite import build_score_panel
from app.quant.factors import FactorError, compute_factor, get_factor
from app.quant.local_engine import build_factor_panels, composite_score
_UNIMPLEMENTED_DEFAULT = [
"exclude_suspended 依赖停牌数据,当前未建模(结果可能包含停牌股)",
@@ -35,8 +35,7 @@ def score_panel_for_factors(daily: pd.DataFrame, factor_specs) -> pd.DataFrame:
回测(LocalEngine)与选股(run_score_selection)共用同一构建 ——
保证 v2 §25/§27「历史回测与当前选股使用同一套引擎」的一致性。
"""
panels = build_factor_panels(daily, factor_specs) # 未知因子在此抛 FactorError
return composite_score(panels)
return build_score_panel(daily, factor_specs) # 未知因子在此抛 FactorError
def resolve_observation_date(daily: pd.DataFrame, as_of: date | None) -> pd.Timestamp | None: