SpectralStrategy更新

This commit is contained in:
2025-11-29 16:35:02 +08:00
parent 29199f9492
commit 687d8a180b
35 changed files with 40381 additions and 1153 deletions

View File

@@ -19,7 +19,7 @@ CONFIG = {
"strategy_params": {
'main_symbol': 'SA', # <-- 替换为你的交易品种代码,例如 'GC=F' (黄金期货), 'ZC=F' (玉米期货)
'trade_volume': 1,
'trade_volume': 2,
'model_indicator': ZScoreATR(14, 100, 0.5, 3),
'spectral_window_days': 8, # STFT窗口大小(天)
'low_freq_days': 8, # 低频下限(天)

View File

@@ -0,0 +1,34 @@
# 策略配置Python格式
from src.indicators.indicators import ZScoreATR, BollingerBandwidth
CONFIG = {
"name": "傅里叶趋势策略",
"version": "1.0",
"enabled": True,
"strategy_class": "futures_trading_strategies.rb.Spectral.SpectralTrendStrategy.SpectralTrendStrategy",
"engine_params": {
"symbol": "KQ.m@SHFE.rb",
"duration_seconds": 900,
"roll_over_mode": True,
"history_length": 1000,
# 支持Python对象
"close_bar_delta": __import__('datetime').timedelta(minutes=58)
},
"strategy_params": {
'main_symbol': 'rb', # <-- 替换为你的交易品种代码,例如 'GC=F' (黄金期货), 'ZC=F' (玉米期货)
'trade_volume': 3,
# 'order_direction': ['SELL', 'BUY'],
# 'indicators': [BollingerBandwidth(20, 2.0, 1.8, 5), BollingerBandwidth(20, 2.0, 1.8, 5),],
'model_indicator': BollingerBandwidth(20, 2.0, 0.5, 3.5),
'bars_per_day': 23,
'spectral_window_days': 4, # STFT窗口大小(天)
'low_freq_days': 4, # 低频下限(天)
'high_freq_days': 2, # 高频上限(天)
'trend_strength_threshold': 0.8, # 相变临界值
'exit_threshold': 0.4, # 退出阈值
'enable_log': True
}
}

View File

@@ -64,7 +64,7 @@ async def start_scheduler():
# 任务 1: 每天 08:55
scheduler.add_job(
scheduled_restart_task,
CronTrigger(hour=8, minute=55),
CronTrigger(hour=8, minute=58),
id="restart_morning",
replace_existing=True
)
@@ -72,7 +72,7 @@ async def start_scheduler():
# 任务 2: 每天 20:55
scheduler.add_job(
scheduled_restart_task,
CronTrigger(hour=20, minute=55),
CronTrigger(hour=20, minute=58),
id="restart_evening",
replace_existing=True
)