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
Generates Python code-based stock alpha factors through a two-agent debate that critiques and refines each candidate. Real runs need an OpenAI-compatible API key, while a dry_run mode checks the install without one.
Trending plugins
7-day copy clicks
Claude hands work to one, or you mention it with @.
Of the plugin's README
Chinese
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
简体中文 | English
论文参考 / Paper Reference
本项目的 FactorMAD-style 多智能体辩论式因子挖掘流程参考自: Duan, Y., Zhang, C., and Li, J. FactorMAD: A Multi-Agent Debate Framework Based on Large Language Models for Interpretable Stock Alpha Factor Mining. In Proceedings of the 6th ACM International Conference on AI in Finance (ICAIF '25), pp. 605-613. ACM, 2025. DOI: 10.1145/3768292.3770377
本仓库是面向 Codex / QUANTSKILLS 的自包含工程化实现,非论文官方代码;实现细节、输入输出格式和运行环境等与论文原始实验可能不同。
下图用于简要说明论文中的 FactorMAD 整体框架和代码型因子生成流程。
不是因子库,也不是回测引擎,而是一个FactorMAD 风格的 LLM 多智能体辩论式因子挖掘 Skill:把“生成一个代码型股票 Alpha 因子”拆成可运行、可检查、可归档的标准流程。
role: skill platform: codex category: tooling status: active validation: runnable output: factor-candidates paradigm: llm multi-agent debate
skill-factormad-debate-factor-mining 是一个自包含的 QUANTSKILLS 社区 Skill。它参考 FactorMAD 论文中的核心思想:让两个 LLM Agent 围绕候选因子进行结构化辩论、批评、修正,并把候选因子输出为可执行 Python 函数,而不是限制在预定义算子集合里。
本仓库提供的是一套研究工作流:从日频 OHLCV 行情或时点一致的 OHLCV/基本面 Parquet 面板出发,生成候选因子代码,做基础代码检查和轻量 Pearson IC、RankIC 与 ICIR 类评估,然后输出可审计 JSON 产物。
自动化因子挖掘常见的失败模式包括:
本 Skill 会提供:
dry_run 模式,不调用 LLM 也能验证安装和输出1. 准备 OHLCV CSV,或准备 OHLCV/基本面分区 Parquet 面板及其 PIT manifest
2. 准备 input JSON,默认示例已使用 dry_run=true 做机械验证
3. 真实运行时复制示例配置,通过 `.env` 或 shell 环境变量设置 API key,并将 dry_run 改为 false
4. 两个 LLM Agent 生成、批评、修正候选因子
5. runtime 检查候选因子代码并计算轻量 Pearson IC、RankIC 与 ICIR 类指标
6. 输出 debate 记录、accepted factors 和 best factor
7. 后续用独立流程做样本外、交易成本、风险暴露和组合级回测
默认命令:
python scripts/factormad_debate_factor.py --input examples/debate_input.json
示例配置默认输出目录:
outputs/debate_example/
如果没有在 input JSON 中设置 output_dir,默认输出目录为:
outputs/debateYYYYMMDDHHMMSS/
至少需要一个行情 CSV、单文件 Parquet 或分区 Parquet 数据集:
date、symbolopen、high、low、close、volumeamount 可选;缺失时 runtime 会用 close * volume 生成vwap 可选;缺失时 runtime 会用 amount / volume 生成;只有原始 CSV 已包含 amount 且存在 adjfactor 时,才会对生成的 vwap 做相应调整date 建议使用 YYYY-MM-DD 或 pandas 可解析日期格式symbol 会作为截面分组键;同一交易日下应包含多个股票label_config.price 对应字段必须在 runtime 标准化后存在,例如 vwap 可由上述逻辑生成market_data_manifest_path,且 manifest 必须声明 future_backfill=false示例输入文件:
examples/debate_input.json
关键字段见:
references/input_schema.md
真实 LLM 运行需要本地凭据。推荐复制 .env.example:
cp .env.example .env
# edit .env, fill OPENAI_API_KEY or FACTORMAD_OPENAI_API_KEY
也可以直接使用 shell 环境变量:
export OPENAI_API_KEY=...
export OPENAI_MODEL=gpt-4o-mini
export OPENAI_BASE_URL=https://api.openai.com/v1
读取优先级为 FACTORMAD_OPENAI_* > OPENAI_*;shell 中已 export 的变量不会被 .env 覆盖。.env 已被 .gitignore 排除,请不要提交真实凭据。
skill-factormad-debate-factor-mining/
├── SKILL.md # Agent skill 入口
├── README.md / README.en.md # 用户向介绍
├── requirements.txt # Python 运行依赖
├── examples/
│ ├── debate_input.json # dry-run 示例输入
│ ├── toy_market_data.csv # toy 行情数据
│ └── factormad_alpha_library/ # 脱敏示例因子库
├── references/
│ ├── source_boundary.md # 数据与来源边界
│ ├── input_schema.md # 输入字段说明
│ ├── output_contract.md # 输出产物契约
│ └── validation_notes.md # 假设、限制与风险边界
├── scripts/
│ ├── factormad_debate_factor.py # CLI 入口
│ └── factormad_runtime/ # 自包含 FactorMAD runtime
└── agents/
└── openai.yaml # OpenAI / Codex metadata
安装依赖:
python -m pip install -r requirements.txt
先跑 dry run,不调用 LLM:
python scripts/factormad_debate_factor.py \
--input examples/debate_input.json
成功后会看到类似输出:
{
"ok": true,
"dry_run": true,
"debate_json_path": "outputs/debate_example/factormad_debate_result.json",
"accepted_factors_path": "outputs/debate_example/accepted_factors.json"
}
如果需要固定目录,可以在命令行显式指定:
python scripts/factormad_debate_factor.py \
--input examples/debate_input.json \
--output outputs/debate
也可以写在 input JSON 里:
{
"output_dir": "outputs/debate_example"
}
优先级是 --output > output_dir > 默认时间戳目录。
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.
Plugins from other owners that cover similar ground
factormad-debate-factor-mining@quantskills is listed by quantskills/registry — review the source before installing
npx claudepluginhub quantskills/registry --plugin factormad-debate-factor-mining