feat(framework_v2): 实现通用配置系统,支持扁平化资产池和策略分组

- 使用 Pydantic Schema 验证配置类型安全
- 实现扁平化 AssetPool,移除预设分类(equity/commodity/fixed_income)
- 移除 MarketType 枚举,改用 group 字符串字段实现策略分组
- AssetConfig 引入 signal_source/trade_source 分离,支持跨市场场景
- ConfigLoader 支持通用 StrategyConfig,向后兼容 RotationStrategyConfig
- 新增 GroupConfig 替代 MarketGroupConfig,支持分散化选股

重构核心:
- market → group(策略分组语义,组内竞争强制分散)
- by_market → by_group
- MarketGroupConfig → GroupConfig
This commit is contained in:
2026-05-24 14:25:25 +08:00
parent 99d3584d05
commit 341611c32b
3 changed files with 763 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
"""
配置模块
提供配置加载、验证、管理功能
"""
from framework_v2.config.schemas import (
# 完整配置
RotationStrategyConfig,
StrategyConfig, # 通用配置
# 子配置
AssetPool,
AssetConfig,
PremiumConfig,
GroupConfig,
FactorConfig,
RotationConfig,
ThresholdConfig,
DynamicThresholdConfig,
RebalanceConfig,
PremiumControlConfig,
DataConfig,
DataSourceConfig,
BenchmarkConfig,
BacktestConfig,
MetadataConfig,
# 枚举(已移除 MarketType改用字符串 group
FactorType,
PremiumMode,
ThresholdMode,
DataSourceType,
)
from framework_v2.config.loader import (
ConfigLoader,
get_config_loader,
load_config,
)
__all__ = [
# 配置 Schema
'RotationStrategyConfig',
'StrategyConfig',
'AssetPool',
'AssetConfig',
'PremiumConfig',
'GroupConfig',
'FactorConfig',
'RotationConfig',
'ThresholdConfig',
'DynamicThresholdConfig',
'RebalanceConfig',
'PremiumControlConfig',
'DataConfig',
'DataSourceConfig',
'BenchmarkConfig',
'BacktestConfig',
'MetadataConfig',
# 枚举(已移除 MarketType改用字符串 group
'FactorType',
'PremiumMode',
'ThresholdMode',
'DataSourceType',
# 加载器
'ConfigLoader',
'get_config_loader',
'load_config',
]