mcpField
S
strategy-pivot-designer

strategy-pivot-designer

github.com/tradermonty其他3.4k3.4k 次安装2 天前更新
代码仓库

关于 strategy-pivot-designer

用于检测回测迭代停滞并提出结构不同策略方案的研究技能,适合优化交易策略的研究者。它生成诊断结果和排序后的转向草案,而非只调整参数。

主要功能

  1. 01检测回测停滞
  2. 02识别过拟合与风险触发项
  3. 03提供三种策略转向方法
  4. 04生成排序后的方案
  5. 05输出研究及可导出 YAML 草案

适用场景

  1. 01应对回测得分停滞
  2. 02重构过拟合或脆弱策略
  3. 03探索成本抹平收益时的替代方案

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/tradermonty/claude-trading-skills --skill strategy-pivot-designer

安装后在 Claude Code 中输入/strategy-pivot-designer确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

requirements.txt
assets/
pivot_report_template.md
references/
pivot_proposal_schema.md
pivot_techniques.md
stagnation_triggers.md
strategy_archetypes.md
scripts/
detect_stagnation.py
generate_pivots.py
scripts/tests/
conftest.py
helpers.py
test_cli_workflow.py
test_detect_stagnation.py
test_generate_pivots.py

详细介绍

策略转向设计器

概述

检测策略的回测迭代循环何时停滞,并提出在结构上不同的策略架构。此技能充当 Edge 流水线(hint-extractor -> concept-synthesizer -> strategy-designer -> candidate-agent)的反馈环,通过重新设计策略骨架而非调整参数,跳出局部最优。

使用时机

  • 尽管经过多轮优化迭代,回测分数仍已停滞。
  • 策略呈现过拟合迹象(样本内表现高,稳健性低)。
  • 交易成本抵消了策略微薄的优势。
  • 尾部风险或回撤超过可接受的阈值。
  • 想要针对同一市场假设探索根本不同的策略架构。

前提条件

  • Python 3.9+
  • PyYAML
  • 迭代历史 JSON(累积的 backtest-expert 评估结果)
  • 源策略草案 YAML(来自 edge-strategy-designer)

输出

  • pivot_drafts/research_only/*.yaml — 与 strategy_draft 兼容的 YAML 提案
  • pivot_drafts/exportable/*.yaml — 可导出的草案 + 供 candidate-agent 使用的工单 YAML
  • pivot_report_*.md — 易于阅读的转向分析报告
  • pivot_manifest_*.json — 所有生成文件的元数据
  • pivot_diagnosis_*.json — 停滞检测结果

工作流

  1. 使用 --append-eval 将回测评估结果累积到迭代历史文件中。
  2. 对历史记录运行停滞检测,以识别触发条件(平台期、过拟合、成本抵消、利润因子不足、尾部风险)。无亏损时的利润因子不属于成本抵消;未定义或溢出的比率需要审核。
  3. 如果诊断结果显示 review_required,请先修复或重新评估底层指标;不要生成转向方案。如果确认停滞,则使用三种技术生成转向提案:假设反转、原型切换、目标重构。
  4. 审核按质量潜力 + 新颖性评分的提案排名。
  5. 对于可导出的提案,工单 YAML 已准备就绪,可用于 edge-candidate-agent 流水线。
  6. 对于 research_only 提案,需要先手动设计策略,再集成到流水线中。
  7. 将选定的转向草案反馈给 backtest-expert,进入下一轮迭代。

快速命令

将回测评估结果追加到历史记录中(若文件不存在则创建):

python3 skills/strategy-pivot-designer/scripts/detect_stagnation.py \
  --append-eval reports/backtest_eval_2026-02-10_120000.json \
  --history reports/iteration_history.json \
  --strategy-id draft_edge_concept_breakout_behavior_riskon_core \
  --changes "Widened stop_loss from 5% to 7%"

检测停滞:

python3 skills/strategy-pivot-designer/scripts/detect_stagnation.py \
  --history reports/iteration_history.json \
  --output-dir reports/

生成转向提案:

python3 skills/strategy-pivot-designer/scripts/generate_pivots.py \
  --diagnosis reports/pivot_diagnosis_*.json \
  --strategy reports/edge_strategy_drafts/draft_*.yaml \
  --max-pivots 3 \
  --output-dir reports/

资源

  • skills/strategy-pivot-designer/scripts/detect_stagnation.py
  • skills/strategy-pivot-designer/scripts/generate_pivots.py
  • references/stagnation_triggers.md
  • references/strategy_archetypes.md
  • references/pivot_techniques.md
  • references/pivot_proposal_schema.md
  • skills/backtest-expert/scripts/evaluate_backtest.py
  • skills/edge-strategy-designer/scripts/design_strategy_drafts.py

评论

支持 Markdown