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
Wraps grouped factor-processing workflows and their pipeline diagrams.
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
skill-factor-grouped-wrapper 是面向大规模量化因子库的分组贪心 Wrapper Skill。它固定预处理和 CPU LightGBM 参数,在训练集拟合模型,可按验证期逐日截面 Pearson IC 或扣除交易成本后的对冲 Sharpe 搜索,并保存可恢复的候选、分组和路径状态。
Backward 与 Forward 是两种可独立使用的模式:Backward 从因子池 A 分组剔除因子;Forward 从候选池 B 分组加入因子。当两者组合运行时,所有 Forward 随机种子都从唯一选定的 A 最优集合开始。默认 IC 模式在搜索期间不运行回测;Sharpe 模式会对每个验证期候选调用独立的 skill-factor-backtest。两种模式都只在集合冻结后比较原始 A、Backward A* 和 Forward final 的样本外表现。
role: skill platforms: codex / claude-code / cursor / hermes / openclaw category: factor status: active maintainer: community validation: runnable model: LightGBM search metric: Pearson IC or hedged Sharpe
本项目是由 X-Tech-group 维护的 QUANTSKILLS Community Project,尚未获得 QUANTSKILLS 官方认证、背书或生产可用性确认。validation: runnable 仅表示仓库测试和合成 smoke 流程通过。
| 平台 | 入口 | 状态 |
|---|---|---|
| Codex | SKILL.md、agents/openai.yaml | 已完成本地运行验证 |
| Claude Code | SKILL.md,必要时使用 agents/portable-loader.md | 已提供标准入口 |
| Cursor | agents/cursor-rule.mdc | 已提供适配入口 |
| Hermes | agents/portable-loader.md | 已提供适配入口 |
| OpenClaw | SKILL.md 或 agents/portable-loader.md | 已提供通用入口 |
除 Codex 本地执行外,其余平台入口用于加载同一套 CLI 和契约,不表示已完成各平台端到端认证。
validate
-> prepare-cache
-> search-backward # 可选模式一
-> search-forward # 可选模式二,可独立或承接 Backward
-> freeze
-> evaluate-oos # 每个冻结快照调用一次 FactorBacktest
搜索阶段使用:
Train: 固定 LightGBM 拟合
Validation: 按配置使用逐日截面 Pearson IC 或扣费对冲 Sharpe 比较候选
OOS: 保持封存,不参与因子、随机种子或参数选择
默认研究模板为 2010-2021 训练、2022 验证、2023-2026-01 OOS;日期由 YAML 配置决定,不写死在代码中。
因子库使用长表主键和宽因子列,可提供单个 Parquet 或目录型 Parquet dataset:
date | ticker | alpha191_001 | alpha191_002 | ...
data.factor_bank:必需,因子池 A。data.external_factor_bank:可选,候选池 B,仅 Forward 使用。initial_factors / external_factors:可显式限定列;为 null 时使用全部非主键列。data.market_data_root 必须与 skill-factor-backtest 的 BackTestData_pq 结构一致。Wrapper 使用 trade_price.parquet 构造下一交易日执行的一日远期收益标签;Sharpe 搜索和 OOS 阶段由 FactorBacktest 使用完整数据根目录。
完整字段与预处理规则见 输入契约。
推荐在 Python 3.11 环境中安装:
python -m pip install -e .
或安装运行依赖:
python -m pip install -r requirements.txt
Sharpe 搜索和 OOS 回测还需要可访问的 skill-factor-backtest。可在 YAML 中设置 backtest.skill_root,也可使用环境变量 FACTOR_BACKTEST_SKILL_ROOT。
复制 完整配置模板,修改因子库、市场数据和输出路径。模板展示 A+B 组合流程:
data:
factor_bank: /path/to/alpha191.parquet
external_factor_bank: /path/to/alpha101_factormad.parquet
selection:
primary_metric: mean_ic
min_delta: 0.001
forward_enabled: true
改用验证期扣费对冲 Sharpe 时,将选择段改为:
selection:
primary_metric: sharpe
min_delta: 0.05
forward_enabled: true
只运行 Backward 时,将 external_factor_bank 设为 null、forward_enabled 设为 false。只运行 Forward 时保留 B 和 forward_enabled: true,完成 cache 后直接执行 search-forward。
grouping.source_prefixes 必须与真实列名前缀完全一致。例如 alpha191_001 应配置 alpha191_。
先校验并准备一次可复用开发缓存:
python scripts/run_factor_grouped_wrapper.py --config /path/to/config.yaml validate
python scripts/run_factor_grouped_wrapper.py --config /path/to/config.yaml prepare-cache
组合运行:
python scripts/run_factor_grouped_wrapper.py --config /path/to/config.yaml search-backward
python scripts/run_factor_grouped_wrapper.py --config /path/to/config.yaml search-forward --run-dir /path/to/run
python scripts/run_factor_grouped_wrapper.py --config /path/to/config.yaml freeze --run-dir /path/to/run
python scripts/run_factor_grouped_wrapper.py --config /path/to/config.yaml evaluate-oos --run-dir /path/to/run
search-backward 的 stdout JSON 会返回新建的 run_dir。后续阶段必须使用该目录。中断后用同一配置和 --run-dir 重跑当前搜索命令;已完成候选会按 fingerprint 复用。
evaluate-oos 已完成后默认拒绝覆盖;只有明确需要重跑时才使用 --force。增加 --report 会要求 FactorBacktest 生成 PDF 报告。
Backward 在每轮评估所有 current - group,只接受主指标提升至少 min_delta 的最佳组;当前 stage 无提升后进入更细 stage。Forward 在每轮评估所有 current + group,使用相同接受规则,直至没有候选组通过门槛。
每个 seed 的固定分组先按 source_prefixes 分桶,再确定性打乱并平衡放入组中。组在同一 stage 内不会因一次接受而重新随机。同一轮候选可由 runtime.candidate_workers 并行,独立 seed 路径可由 runtime.seed_workers 并行;每条路径内依赖前序结果的迭代仍顺序执行。多 seed 完成后按主指标及诊断指标选择唯一最佳路径;存活频率只作为诊断,不自动投票生成集合。
算法细节见 算法说明。
稳定开发结果:
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-grouped-wrapper@quantskills is listed by quantskills/registry — review the source before installing
npx claudepluginhub quantskills/registry --plugin factor-grouped-wrapperPlugins from other owners that cover similar ground