Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By quantskillsGPL-3.0In 1 marketplace
Local closed-loop factor research: generate, validate, backtest, diagnose, learn, iterate N rounds. Self-improving alpha discovery and optimization.
Claude hands work to one, or you mention it with @.
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
简体中文 | English
面向 AI Agent 的本地闭环因子进化技能:生成候选因子、验证、用 PandaData A 股数据回测、诊断表现、让 LLM 提出语义改进,然后迭代。
本技能仅用于研究流程,不构成投资建议。
可以从以下内容开始:
如果没有明确指定目标或输出,默认目标是提高 Sharpe,并由 Agent 自行设计初始候选因子。
所有表达式都必须遵循因子契约。
示例:
帮我优化这个因子,跑 3 轮:
rank(returns(close,20) / ts_std(returns(close,1),60))
随机生成 10 个动量和反转候选因子,跑 5 轮进化。
在技能根目录创建 .env:
PANDA_AI_USERNAME="your_username"
PANDA_AI_[REDACTED:Password]
PANDA_AI_BASE_URL="http://pandadata.pandaaiquant.com"
安装依赖:
pip install -r requirements.txt
优先阅读 final_summary.json,其中包含:
其他常用输出:
diagnosis.json:每个因子的指标和分类。backtest_results_all.json:所有迭代的回测结果。knowledge_base.json:本次运行学到的模式。candidate_evolution.json:因子父子关系。evolution_diagram.md:进化图。trading_data/:组合收益、IC 序列和持仓。多次运行进化流程后,output/ 目录下会积累多个 run_* 文件夹。使用
build_alpha_library.py 将所有运行的 final_summary.json 合并成一个统一的
因子库,并按表达式去重(相同表达式保留 Sharpe 最高的那次)。
# 基本用法:扫描 output/ 下所有 run_*,生成 alpha_library.json
python scripts/build_alpha_library.py
# 指定输出路径
python scripts/build_alpha_library.py --output my_library.json
# 只保留 Sharpe ≥ 0.3 的因子
python scripts/build_alpha_library.py --min-sharpe 0.3
# 指定自定义 output 目录
python scripts/build_alpha_library.py --output-dir /path/to/output
| 参数 | 说明 | 默认值 |
|---|---|---|
--output | 输出 JSON 文件路径 | alpha_library.json(技能根目录) |
--min-sharpe | 最低 Sharpe 阈值,低于此值的因子不收录 | 无限制 |
--output-dir | 包含 run_* 文件夹的目录 | ./output/ |
生成的 alpha_library.json 结构:
{
"meta": {
"total_factors": 60,
"total_runs_scanned": 12,
"total_runs_contributing": 12,
"positive_sharpe_count": 28,
"best_sharpe": 0.8656,
"worst_sharpe": -0.4289,
"min_sharpe_filter": null
},
"entries": [
{
"expression": "-1 * rank(delta(returns(close, 10), 5) / ...)",
"sharpe": 0.8656,
"source_run": "run_20260713_194041_model_creativity",
"source_query": "use your creativity to generate powerful alphas",
"worth_keeping": true,
"slug": "1_rank_delta_returns_close_10_5_max_..."
}
]
}
每个因子条目包含:
expression — 因子表达式。sharpe — 年化 Sharpe 比率。source_run — 来源运行目录名。source_query — 触发该运行的原始查询。worth_keeping — 该运行是否值得保留。slug — 表达式导出的短标识名。因子按 Sharpe 从高到低排序。meta 中提供汇总统计,方便快速了解库的整体质量。
通过 config.json 调整回测区间、股票池、成本、停止条件、分类阈值和变换设置。
如果用户明确指定参数,例如“跑 10 轮”或“用 CSI 500”,本次运行应优先使用用户指定值。
SKILL.md:Agent 主说明。references/factor-contract.md:字段、函数和表达式规则。references/optimization-protocol.md:循环协议和分类规则。references/agent-integration.md:安装和冒烟测试。GPL-3.0. See LICENSE.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
factor-loop-evolve@quantskills is listed by quantskills/registry — review the source before installing
npx claudepluginhub quantskills/registry --plugin factor-loop-evolvePlugins from other owners that cover similar ground