Agent skill

Backtest Center

by qusong0627 in qusong0627/QuantMind

回测中心 — 快速回测、专家模式、回测历史、策略对比、参数优化、策略管理、高级分析。在 QuantBot / Claude Code 中运行 Qlib 回测、对比策略、优化参数、分析回测结果、管理策略时使用。触发词:回测、回测中心、运行回测、策略对比、参数优化、回测历史、专家模式、高级分析、模型回测、推理回测

AGPL-3.0Auto-check passedBusiness, Finance & HR

Install Backtest Center

skills CLI
$ npx skills add qusong0627/QuantMind --skill backtest-center -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install qusong0627/QuantMind backtest-center --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/qusong0627/QuantMind.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/backtest-center .claude/skills/backtest-center && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
backtest-center
GitHub stars
1.7k
Token cost
~1.8k tokens
SKILL.md length
158 words
Files
1
Skills in repo
27
Repo updated
First seen
Licence
AGPL-3.0

At a glance

回测中心 — 快速回测、专家模式、回测历史、策略对比、参数优化、策略管理、高级分析。在 QuantBot / Claude Code 中运行 Qlib 回测、对比策略、优化参数、分析回测结果、管理策略时使用。触发词:回测、回测中心、运行回测、策略对比、参数优化、回测历史、专家模式、高级分析、模型回测、推理回测

  • Works in 10 steps: 快速回测(单次 Qlib 回测) → 专家模式(云端策略开发与回测) → 回测结果 / 历史 → …
  • Tasks that involve Trading and backtesting
  • SKILL.md covers 架构, 认证, 1. 快速回测(单次 Qlib 回测) and 2. 专家模式(云端策略开发与回测), plus 8 more sections
  • Calls curl and python3

What it does

Backtest Center is an agent skill from qusong0627/QuantMind. 回测中心 — 快速回测、专家模式、回测历史、策略对比、参数优化、策略管理、高级分析。在 QuantBot / Claude Code 中运行 Qlib 回测、对比策略、优化参数、分析回测结果、管理策略时使用。触发词:回测、回测中心、运行回测、策略对比、参数优化、回测历史、专家模式、高级分析、模型回测、推理回测

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Business, Finance & HR, covering Trading and backtesting. The repository describes itself as: QuantMind(量化大脑)开源版是一款面向个人开发者与投研团队的 AI 原生多市场量化交易平台。深度集成微软 Qlib、RD-Agent 因子演化与 QuantBot全能工作台,提供从 300+ 维因子挖掘、13 种机器学习与深度学习模型工场、Qlib 高性能回测、截面批量推理、7x24… The licence is AGPL-3.0.

When your agent uses it

  • Tasks that involve Trading and backtesting

Example prompts

  • “/backtest-center”

Requirements

  • Python 3

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. 快速回测(单次 Qlib 回测)
  2. 专家模式(云端策略开发与回测)
  3. 回测结果 / 历史
  4. 策略对比
  5. 参数优化(遗传算法)
  6. 高级分析(深度性能分析)
  7. 报告导出
  8. 实战流程(推荐)
  9. 相关技能
  10. 常见问题

What it can do on your machine

Read from SKILL.md and the folder at commit 2e93d9a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • curl
    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use curl, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Backtest Center loads about 1.8k tokens when it runs. Until then it costs about 43 tokens; SKILL.md has 158 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~43
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from qusong0627/QuantMind at commit 2e93d9a, republished under its AGPL-3.0 licence (© qusong0627). 158 words, ~1,844 tokens.

Download SKILL.mdSave it as .claude/skills/backtest-center/SKILL.md (or your agent's skills folder).
name
backtest-center
description
回测中心 — 快速回测、专家模式、回测历史、策略对比、参数优化、策略管理、高级分析。在 QuantBot / Claude Code 中运行 Qlib 回测、对比策略、优化参数、分析回测结果、管理策略时使用。触发词:回测、回测中心、运行回测、策略对比、参数优化、回测历史、专家模式、高级分析、模型回测、推理回测

⚙️ 本技能遵循公共运行环境契约(最高优先级,先于本文其余内容执行): 详见 _shared/env-contract.md,执行前先读它。

回测中心技能

QuantMind 回测中心的完整操作指南。覆盖 7 大功能:快速回测、专家模式、回测历史、策略对比、参数优化、策略管理、高级分析。

架构

回测走 engine 服务(8001)的 Qlib 引擎,API 网关(8000)代理。核心路径前缀见下文 qlib/* 各节。

认证

bash
BASE=http://127.0.0.1:8000
TOKEN=$(curl -s -X POST $BASE/api/v1/auth/login -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"admin123","tenant_id":"default"}' \
  | python3 -c "import sys,json; print(json.load(sys.stdin).get('access_token',''))")
AUTH="Authorization: Bearer $TOKEN"
CT="Content-Type: application/json"

1. 快速回测(单次 Qlib 回测)

1.0 向量化极速回测(新)

QlibBacktestRequest.use_vectorized: bool(默认 false)触发向量化极速引擎(纯 pandas 矩阵运算,全市场近 1 年从 500s+ 降到秒级~分钟级)。

bash
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/qlib/backtest" \
  -d '{
    "strategy_type": "CustomStrategy",
    "strategy_content": "STRATEGY_CONFIG = {...}",
    "model_id": "mdl_cn_xxx",
    "start_date": "2025-01-01",
    "end_date": "2025-12-31",
    "universe": "csi300",
    "initial_capital": 1000000,
    "benchmark": "000300.SH",
    "use_vectorized": true,
    "strategy_params": {"signal": "<PRED>", "topk": 50},
    "qlib_provider_uri": "db/qlib_data",
    "qlib_region": "cn"
  }'

安全门:use_vectorized=true 时系统自动检测策略是否"向量化安全"(纯 TopK 全换 + 无加权/无止损/无 pool_file/无自定义类)。不安全策略自动退回 step 模式保语义。

1.1 提交回测
bash
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/qlib/backtest" \
  -d '{
    "strategy_id": "strategy_xxx",
    "start_date": "2024-01-01",
    "end_date": "2024-12-31",
    "initial_capital": 1000000,
    "benchmark": "000300.SH"
  }'

返回:backtest_id + 初始结果。后续用 backtest_id 查结果/日志/分析。

1.2 模型滚动回测(管理端)
bash
# 可用回测交易日
curl -s -H "$AUTH" "$BASE/api/v1/admin/models/backtest/trading-dates?start=2025-01-01&end=2025-12-31"

# 可用于回测的模型列表
curl -s -H "$AUTH" "$BASE/api/v1/admin/models/list-for-backtest"

# 启动模型滚动回测
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/admin/models/backtest" \
  -d '{"model_id":"mdl_xxx","start":"2025-01-01","end":"2025-12-31"}'
# ⚠️ 多周期对比回测已下线:管理端 multi-horizon 路由不存在(2026-09 清理)
1.3 推理回测(选股策略事件驱动)
bash
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/admin/models/inference-backtest" \
  -d '{
    "model_id":"mdl_xxx",
    "start_date":"2025-01-01",
    "end_date":"2025-12-31",
    "signal_mode":"stored",
    "strategy":{"top_k":20,"side":"long"}
  }'

signal_mode:stored(用已存信号)/ realtime(实时生成)

2. 专家模式(云端策略开发与回测)

2.1 策略管理
bash
# 策略列表
curl -s -H "$AUTH" "$BASE/api/v1/strategies"

# 策略模板
curl -s -H "$AUTH" "$BASE/api/v1/strategies/templates"

# 创建策略
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/strategies" \
  -d '{"name":"我的策略","description":"动量策略","strategy_type":"TopkDropoutStrategy","params":{"topk":20}}'

# 激活策略
curl -s -X POST -H "$AUTH" "$BASE/api/v1/strategies/{strategy_id}/activate"

3. 回测结果 / 历史

bash
# 回测结果(含净值/回撤/交易/指标)
curl -s -H "$AUTH" "$BASE/api/v1/qlib/results/{backtest_id}"
# 回测成交明细
curl -s -H "$AUTH" "$BASE/api/v1/qlib/results/{backtest_id}/trades"
# 回测状态(轮询,注意路径是 backtest 单数)
curl -s -H "$AUTH" "$BASE/api/v1/qlib/backtest/{backtest_id}/status"
# 删除回测记录
curl -s -X DELETE -H "$AUTH" "$BASE/api/v1/qlib/results/{backtest_id}"

# 我的回测历史
curl -s -H "$AUTH" "$BASE/api/v1/qlib/history/me"
# 模型滚动回测历史(管理端)
curl -s -H "$AUTH" "$BASE/api/v1/admin/models/backtest/history/{model_id}?limit=20"
curl -s -H "$AUTH" "$BASE/api/v1/admin/models/backtest/history/{model_id}/{run_id}"
curl -s -X DELETE -H "$AUTH" "$BASE/api/v1/admin/models/backtest/history/{model_id}/{run_id}"

4. 策略对比

4.1 对比两个回测结果
bash
curl -s -H "$AUTH" "$BASE/api/v1/qlib/compare/{id1}/{id2}"
4.2 多模型对比

多周期对比回测(管理端 multi-horizon)已于 2026-09 下线;多策略/多模型对比改用 compare(结果级)或在训练侧按单周期分别训练模型再各自回测。

5. 参数优化(遗传算法)

bash
# 提交参数优化(默认算法)
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/qlib/optimize" \
  -d '{
    "strategy_id": "strategy_xxx",
    "start_date": "2024-01-01",
    "end_date": "2024-12-31",
    "param_ranges": {
      "topk": [5, 50],
      "n_drop": [1, 10],
      "rebalance_period": [5, 30]
    },
    "generations": 10,
    "population_size": 20
  }'
# 返回 optimization_id

# 遗传算法优化(专门入口)
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/qlib/optimize/genetic" \
  -d '{"strategy_id":"strategy_xxx","start_date":"2024-01-01","end_date":"2024-12-31","param_ranges":{"topk":[5,50]},"generations":10,"population_size":20}'

# 查询优化结果
curl -s -H "$AUTH" "$BASE/api/v1/qlib/optimization/{optimization_id}"
# 优化历史
curl -s -H "$AUTH" "$BASE/api/v1/qlib/optimization/history"

6. 高级分析(深度性能分析)

高级分析端点统一挂在分析前缀下(analysis/*,完整形如 /api/v1/analysis/basic-risk)。

6.1 基础风险
bash
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/analysis/basic-risk" \
  -d '{"backtest_id":"xxx"}'
6.2 绩效归因
bash
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/analysis/performance" \
  -d '{"backtest_id":"xxx"}'
6.3 交易统计
bash
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/analysis/trade-stats" \
  -d '{"backtest_id":"xxx"}'
6.4 基准对比
bash
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/analysis/benchmark" \
  -d '{"backtest_id":"xxx"}'
6.5 持仓分析
bash
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/analysis/position" \
  -d '{"backtest_id":"xxx"}'
6.6 因子分析
bash
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/analysis/factor-analysis" \
  -d '{"backtest_id":"xxx"}'
6.7 风格归因
bash
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/analysis/style-attribution" \
  -d '{"backtest_id":"xxx"}'
6.8 风险指标与告警
bash
# 风险指标(回撤/夏普/波动等)
curl -s -H "$AUTH" "$BASE/api/v1/qlib/risk/{backtest_id}/metrics"
# 风险告警
curl -s -H "$AUTH" "$BASE/api/v1/qlib/risk/{backtest_id}/alerts"
# 风险配置
curl -s -X POST -H "$AUTH" -H "$CT" "$BASE/api/v1/qlib/risk/{backtest_id}/config" \
  -d '{"max_drawdown":0.15,"var_confidence":0.95}'
6.9 回测日志
bash
curl -s -H "$AUTH" "$BASE/api/v1/qlib/logs/{backtest_id}"

7. 报告导出

bash
# CSV / PDF / Excel 报告
curl -s -H "$AUTH" "$BASE/api/v1/qlib/export/{backtest_id}/csv" -o backtest_report.csv
curl -s -H "$AUTH" "$BASE/api/v1/qlib/export/{backtest_id}/pdf" -o backtest_report.pdf
curl -s -H "$AUTH" "$BASE/api/v1/qlib/export/{backtest_id}/excel" -o backtest_report.xlsx

8. 实战流程(推荐)

当用户要求"回测策略/模型"时:

  1. 确认策略:/strategies 或 /admin/models/list-for-backtest 选回测对象
  2. 确认日期:/admin/models/backtest/trading-dates 选区间
  3. 运行回测:/admin/models/backtest 或 /qlib/backtest
  4. 查日志:/qlib/logs/{id} 确认完成
  5. 深度分析:/qlib/analysis/* + /qlib/risk/{id}/metrics
  6. 对比:多策略用 compare(结果级对比)
  7. 导出:PDF / Excel 报告
  8. 参数调优:/qlib/optimize 遗传算法搜索最优参数

9. 相关技能

  • [[ai-ide-strategy-writing]] — AI-IDE 写策略(自然语言生成 Qlib 策略代码)
  • [[simulation-trading]] — 模拟交易(下单/持仓/成交)
  • [[smart-strategy-stock-picking]] — 条件选股(生成股票池)
  • [[quantmind-operations]] — 模型训练/推理

10. 常见问题

现象处理
回测无结果确认日期区间有交易日数据,查 /qlib/logs/{id}
策略列表空先创建策略或从模板同步 /strategies/templates
参数优化慢减少 generations/population_size
报告导出失败确认 backtest_id 存在且有完整结果

© qusong0627, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/backtest-center of qusong0627/QuantMind.

Open the folder on GitHubat commit 2e93d9a

Compare with similar skills

Backtest Center next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Backtest Center compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Backtest Center this skillqusong0627/QuantMind1.7k—~1.8kAutomated safety check: PassAGPL-3.0
Tushare Datazillionare/zillionare3212 repos~2.3kAutomated safety check: PassNone
Tradingview MCPatilaahmettaner/tradingview-mcp5k—~1.3kAutomated safety check: PassMIT
Digital Oraclekomako-workshop/digital-oracle875—~5.9kAutomated safety check: PassMIT
Polyclawchainstacklabs/polyclaw3591 repos~2kAutomated safety check: PassApache-2.0
Markdownfacioquo/stock-indicators-dotnet1.2k—~812Automated safety check: PassApache-2.0

Similar skills

  • Tushare Data

    zillionare/zillionare

    面向中文自然语言的 Tushare 数据研究技能。用于把“看看这只股票最近怎么样”“帮我查财报趋势”“最近哪个板块最强”“北向资金在买什么”“给我导出一份行情数据”这类请求,转成可执行的数据获取、清洗、对比、筛选、导出与简要分析流程。适用于 A 股、指数、ETF/基金、财务、估值、资金流、公告新闻、板块概念与宏观数据等研究场景。

    321 GitHub starsUsed in 2 repos~2.3k tokens
    Business, Finance & HRAuto-check passed
  • Tradingview MCP

    atilaahmettaner/tradingview-mcp

    AI Trading Intelligence — live prices, 30+ technical indicators, backtesting (6 strategies), walk-forward overfitting detection, trade logs, equity curves, licensed news sentiment (Marketaux), and…

    5k GitHub stars~1.3k tokensUpdated 2 days ago
    Business, Finance & HRAuto-check passed
  • Digital Oracle

    komako-workshop/digital-oracle

    Answer prediction questions using market trading data, not opinions.

    875 GitHub stars~5.9k tokensUpdated 2 mo ago
    Business, Finance & HRAuto-check passed
  • Polyclaw

    chainstacklabs/polyclaw

    Trade on Polymarket via split + CLOB execution. An agent skill from chainstacklabs/polyclaw.

    359 GitHub starsUsed in 1 repo~2k tokens
    Business, Finance & HRAuto-check passed
  • Markdown

    facioquo/stock-indicators-dotnet

    Format and lint Markdown in this repository against GitHub Flavored Markdown and its markdownlint-cli2 configuration — headers, lists, code fences, callouts (VitePress containers on docs-site pages…

    1.2k GitHub stars~812 tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Openmobius Skill

    MobiusQuant/OpenMobius-skill

    Provides multi-school trading Q&A, chart/OHLCV analysis, annotation, and fresh-market workflows covering ICT/SMC, ChanLun, Wyckoff, Price Action, Order Flow, VSA, and Elliott Wave.

    695 GitHub stars~7.2k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed

More from qusong0627/QuantMind

All 27 skills in this repo
  • A-Share Daily Review

    qusong0627/QuantMind

    Produces a post-market review report for the China A-share market from local QuantDB data, news sentiment and model signals, ending in a next-day direction call.

    1.7k GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Queries Futu quotes, options, fundamentals and accounts and places orders through the Futu OpenAPI Python SDK, defaulting to simulated trading.

    1.7k GitHub stars~3.3k tokensUpdated today
    Auto-check: notes
  • Turns a plain-language model training request into a validated QuantMind training config file that can be imported from the Model Training page.

    1.7k GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Tiger Brokers OpenAPI SDK

    qusong0627/QuantMind

    Covers the Tiger Brokers OpenAPI Python SDK for market data, stock, futures and options trading, push subscriptions, a CLI and an MCP server, defaulting to paper trading.

    1.7k GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Tiger Brokers C++ OpenAPI SDK

    qusong0627/QuantMind

    Guides an agent through the Tiger Brokers OpenAPI C++ SDK for build setup, market data, orders and real-time push, defaulting to paper trading.

    1.7k GitHub stars~942 tokensUpdated today
    Auto-check passed
  • Tiger Brokers OpenAPI C# SDK

    qusong0627/QuantMind

    Guides building C# and .NET apps on the Tiger Brokers OpenAPI SDK: setup, market data, orders, accounts, options and real-time push, defaulting to paper trading.

    1.7k GitHub stars~1k tokensUpdated today
    Auto-check passed

Questions about Backtest Center

What does Backtest Center do?

回测中心 — 快速回测、专家模式、回测历史、策略对比、参数优化、策略管理、高级分析。在 QuantBot / Claude Code 中运行 Qlib 回测、对比策略、优化参数、分析回测结果、管理策略时使用。触发词:回测、回测中心、运行回测、策略对比、参数优化、回测历史、专家模式、高级分析、模型回测、推理回测. Backtest Center is an agent skill from qusong0627/QuantMind.

When should I use Backtest Center?

Backtest Center fits situations like: tasks that involve Trading and backtesting.

How do I install Backtest Center in Claude Code?

Run `npx skills add qusong0627/QuantMind --skill backtest-center -a claude-code`. Or copy the skill folder (skills/backtest-center in qusong0627/QuantMind) into .claude/skills/backtest-center in your project. Claude Code loads it when a task matches its description.

How do I install Backtest Center in Codex?

Run `npx skills add qusong0627/QuantMind --skill backtest-center -a codex`. Or copy the skill folder (skills/backtest-center in qusong0627/QuantMind) into .agents/skills/backtest-center in your project. Codex loads it when a task matches its description.

Can I use Backtest Center in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add qusong0627/QuantMind --skill backtest-center -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/backtest-center, .gemini/skills/backtest-center, .github/skills/backtest-center and .opencode/skills/backtest-center in your project.

What does Backtest Center need to run?

Going by SKILL.md and its folder, Backtest Center needs the command-line tools its instructions call (curl and python3). Our summary lists: Python 3.

Does Backtest Center access the network?

SKILL.md contains no URLs. Its commands use curl, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Backtest Center safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Backtest Center use?

Backtest Center is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Backtest Center use?

About 1.8k tokens (SKILL.md is roughly 7.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Backtest Center?

Skills that share tags, products or a category with Backtest Center: Tushare Data (zillionare/zillionare, 321 stars), Tradingview MCP (atilaahmettaner/tradingview-mcp, 5k stars), Digital Oracle (komako-workshop/digital-oracle, 875 stars) and Polyclaw (chainstacklabs/polyclaw, 359 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Backtest Center?

qusong0627 (a GitHub user) maintains it in qusong0627/QuantMind, which has 1,723 GitHub stars. The repository holds 27 skills in this directory. The repository was last updated on October 9, 2026.

Source: qusong0627/QuantMind on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.