refactor(framework): 框架只保留抽象接口,具体实现移至strategies/shared

- FactorBase/FactorRegistry/FactorCombiner: 因子抽象接口
- SignalGenerator: 信号生成抽象接口
- RiskControl/Position/CallbackHook: 风控抽象接口
- StrategyBase: 策略抽象基类
- Executor/Portfolio: 执行器抽象接口
- ConfigLoader: 配置加载器
- 删除framework/factors/momentum.py(具体实现)
This commit is contained in:
2026-05-11 23:09:01 +08:00
parent 9a8a0d7c72
commit 30ea2970bd
8 changed files with 503 additions and 1516 deletions

View File

@@ -1,21 +1,52 @@
"""
量化策略通用框架
框架统一入口(通用)
融合Freqtrade回调机制 + 模块化因子设计
只导出抽象接口具体实现在strategies/shared/
"""
from .factors import FactorBase, FactorRegistry, FactorCombiner
from .signals import SignalGenerator, TopNSelector, TrendFollower, ReversalTrader
from .strategy import StrategyBase, RotationStrategy
from .risk import RiskControl, StopLossControl, PositionLimitControl
from .execution import Executor, BacktestExecutor, DryRunExecutor
from .config import ConfigLoader
# 因子层抽象
from framework.factors import FactorBase, FactorRegistry, FactorCombiner
# 信号层抽象
from framework.signals import SignalGenerator
# 风控层抽象
from framework.risk import Position, RiskControl, CallbackHook
# 策略层抽象
from framework.strategy import StrategyBase
# 执行层抽象
from framework.execution import Portfolio, Executor, BacktestExecutor, DryRunExecutor
# 配置层
from framework.config import ConfigLoader, StrategyConfig
__all__ = [
'FactorBase', 'FactorRegistry', 'FactorCombiner',
'SignalGenerator', 'TopNSelector', 'TrendFollower', 'ReversalTrader',
'StrategyBase', 'RotationStrategy',
'RiskControl', 'StopLossControl', 'PositionLimitControl',
'Executor', 'BacktestExecutor', 'DryRunExecutor',
# 因子层
'FactorBase',
'FactorRegistry',
'FactorCombiner',
# 信号层
'SignalGenerator',
# 风控层
'Position',
'RiskControl',
'CallbackHook',
# 策略层
'StrategyBase',
# 执行层
'Portfolio',
'Executor',
'BacktestExecutor',
'DryRunExecutor',
# 配置层
'ConfigLoader',
'StrategyConfig',
]