Factor Backtest Skill logo

Factor Backtest Skill

Community
GRD-Chang
factor-backtest-skill

安全、高效地批量回测 8 个 Alpha 表达式,内置验证、熔断和异常处理机制。

Overview

PublisherGRD-Chang
Repositoryworldquant-skill
Skill namefactor-backtest-skill
Stars
87
Forks
21
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by GRD-Chang on GitHub. Read the source before you install it.

Installation

Install the Factor Backtest Skill AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/GRD-Chang/worldquant-skill/tree/master/skills/factor_backtest
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/GRD-Chang/worldquant-skill.git /tmp/worldquant-skill
mkdir -p .claude/skills
cp -r /tmp/worldquant-skill/skills/factor_backtest .claude/skills/factor-backtest-skill
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Factor Backtest Skill in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Factor Backtest Skill on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Factor Backtest Skill is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

因子回测 Skill

📌 用途

当你有 8 个 Alpha 表达式需要批量回测时,使用此技能。它会:

  • ✅ 验证表达式的合法性
  • ✅ 提交批量回测任务
  • ✅ 监控进度并处理异常
  • ✅ 返回完整的回测结果

🔑 核心约束(不可违反)

1. Rule of 8

  • 必须恰好传入 8 个表达式
  • 少于或多于 8 个都会被平台拒绝

2. 加速配置

  • 必须设置 visualization=false(大幅加速回测)

3. 中性化选择

neutralization 必须从以下 5 项中选一:

值适用场景
SLOW适用于低换手率信号(<50%年化)、长期趋势捕捉、基本面或价值策略
FAST适用于高换手率信号(>70%年化)、短期趋势捕捉、高频数据或短期价格动量策略
SLOW_AND_FAST适用于同时考虑短期和长期趋势的策略、多元化Alpha组合、平衡型投资策略
REVERSION_AND_MOMENTUM适用于需要对冲短期均值回归和长期动量的策略、平衡型多空Alpha因子
CROWDING适用于希望降低拥挤交易风险的策略、强动量市场环境、流行因子或拥挤交易策略

🔄 标准流程(4 步)

步骤 1:验证表达式

mcp:validate_alpha_expressions([表达式1, ..., 表达式8])

  • 要求:必须 100% 通过验证
  • 失败处理:修正错误 → 重新验证 → 严禁未全部通过就进入回测

步骤 2:提交回测

mcp: create_multiSim( alpha_expressions=[表达式1, ..., 表达式8], ... )

步骤 3:监控进度

mcp: check_multisimulation_status()

监控策略:

  • ⏱️ 回测时间较长,可每 5–10 分钟查询一次
  • 🚨 僵尸回测熔断:超过 40 分钟仍 in_progress → 放弃当前任务,重新提交

步骤 4:获取结果

mcp: get_multisimulation_result()


⚠️ 异常处理

语法错误

现象:回测返回 "No alpha ID found in completed simulation"

处理:

  1. 调用 get_SimError_detail 查看详细错误
  2. 对照 get_operators 检查操作符签名
  3. 修正表达式 → 重新走完整验证流程
  4. ❌ 严禁无修改直接重试

回测卡死

现象:状态持续 in_progress 超过 40 分钟

处理:

  1. 重新认证会话
  2. 再次检查状态
  3. 若仍卡死 → 放弃当前任务,创建新回测

🚫 禁止操作

  • ❌ 传入非 8 个表达式
  • ❌ 使用 neutralization 列表外的值
  • ❌ 设置 visualization=true
  • ❌ 语法错误后无修改重试
  • ❌ 高频轮询状态(< 5 分钟)

📊 输入/输出

输入

python
{
    "alpha_expressions": [8 个表达式],
    "decay": 5,                          # 可选
    "neutralization": "SLOW",            # 必须从 5 项中选
    "truncation": 0.0,                   # 可选
    "test_period": "P0Y0M"               # 可选
}

输出

python
{
    "location": "multiSim 结果 URL",
    "alphas": [
        {
            "alpha_id": "...",
            "sharpe": 1.8,
            "fitness": 1.2,
            "turnover": 0.25,
            "ic": 0.05
        },
        ...
    ],
    "status": "completed" | "failed",
    "errors": []
}

🛠️ 常用 MCP 工具

核心:

  • validate_alpha_expressions - 验证表达式
  • create_multiSim - 批量回测
  • check_multisimulation_status - 检查状态
  • get_multisimulation_result - 获取结果

分析:

  • get_alpha_details - 详细指标
  • get_alpha_pnl - 收益曲线
  • get_alpha_yearly_stats - 年度统计
  • check_correlation - 相关性检查

调试:

  • get_SimError_detail - 错误详情
  • get_operators - 操作符列表

Frequently asked questions

What does the Factor Backtest Skill AI skill do?

安全、高效地批量回测 8 个 Alpha 表达式,内置验证、熔断和异常处理机制。

Why use Factor Backtest Skill on TypingMind?

Because you install it once and use it with any model. Factor Backtest Skill is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Factor Backtest Skill in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/GRD-Chang/worldquant-skill/tree/master/skills/factor_backtest. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Factor Backtest Skill?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Factor Backtest Skill?

As many as you like. As long as a model supports skills, you can use Factor Backtest Skill with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Factor Backtest Skill AI skill free?

It is published on GitHub by GRD-Chang. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇