Files
AlphaMaster/train_precious_metals.py
T
rosemarycox5334-debug 662e7ac5d2 precious_metals_v1: 黄金单品种策略 (Sharpe 2.66, MDD -11%, 8年数据验证)
策略: DMI_ADX_14 -> KYLE_LAMBDA -> EMA_20 -> KYLE_LAMBDA -> MFI14 -> SCALE -> TS_CORR_10 -> IF_GT
- 微型市场体制切换模型: 流动性驱动时用Kyle动量, 流动性紊乱时退守趋势
- 推荐用法: XAUUSD单品种
- 回测: 年化+28.2%, Sharpe 2.66, 换手109笔/年, Walk-Forward 3/4折盈利

配置变更:
- AAVUSD移除(实为Aave加密货币)
- COCOA.c移除(交易时段不匹配)
- metals_comm重命名为precious_metals(XAUUSD+XAGUSD)
- 算子溢出修复(_signed_power clamp, _ts_product expm1 clamp)
2026-07-06 23:05:05 +08:00

40 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
train_precious_metals.py — 贵金属策略训练(XAUUSD + XAGUSD)
"""
import sys, time
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from config import Config
from data_pipeline.fetcher import MT5DataFetcher
from model_core.config import ModelConfig
from main import train_group
def main():
offline = "--offline" in sys.argv
t0 = time.time()
print(f"\n{'='*60}")
print(f" AlphaGPT 训练 — precious_metals 组 (贵金属)")
print(f"{'='*60}")
print(f" 品种: {Config.SYMBOL_GROUPS['precious_metals']}")
print(f" 奖励模式: {ModelConfig.REWARD_MODE}")
print(f" 训练步数: {ModelConfig.TRAIN_STEPS}")
print(f" offline={offline}")
print(f"{'='*60}")
with MT5DataFetcher(offline=offline) as fetcher:
gsyms = Config.SYMBOL_GROUPS["precious_metals"]
eng = train_group(fetcher, "precious_metals", gsyms, offline)
if eng is not None:
print(f"\n<<< [precious_metals] 完成: score={eng.best_score:.4f}")
print(f" {eng._decode_formula(eng.best_formula)}")
else:
print("\n<<< [precious_metals] 失败")
elapsed = time.time() - t0
print(f"\n耗时 {elapsed/3600:.2f}h")
if __name__ == "__main__":
main()