by Miasyster
Agent-driven alpha factory — LLM autonomously designs, backtests, and submits factors to WorldQuant BRAIN
# Add to your Claude Code skills
git clone https://github.com/Miasyster/QuantGPTAgent-Driven LLM Quant Research Engine — Autonomous Factor Mining at WorldQuant BRAIN Submission Quality
LLM Agent 自治因子挖矿 → 批量回测 → 多维评分 → 反过拟合验证 → WQ BRAIN 自动提交 | 全程零人工干预
Quick Start · Architecture · API Docs · MCP Guide · Factor Mining · Contributing
QuantGPT is an agent-driven factor research engine — not a backtest library, not a chatbot wrapper. It gives an LLM Agent (Claude, via MCP) a complete toolkit to autonomously discover, evaluate, iterate, and submit alpha factors to WorldQuant BRAIN, with zero human intervention per research cycle.
The core architecture:
LLM Agent (Claude Code / Claude Desktop)
│
├── MCP Tools (14 个) ← Agent 的工具箱
│ ├── run_backtest ← 全市场分组回测
│ ├── score_factor ← 0-100 综合评分
│ ├── diagnose_factor ← 失败模式诊断
│ ├── run_anti_overfit ← 4 项反过拟合检验
│ ├── run_rolling_validation ← Walk-forward 验证
│ ├── validate_expression ← 语法校验
│ ├── list_operators ← 50+ 算子文档
│ ├── list_universes ← 股票池和基准
│ ├── wq_brain_submit ← WQ BRAIN 单因子提交
│ ├── wq_brain_batch_submit ← 批量参数扫描提交
│ ├── wq_brain_submit_by_ids ← 按 ID 提交
│ ├── wq_brain_list_alphas ← 查询已提交 alpha
│ ├── wq_brain_check_alphas ← 检查 alpha 状态
│ └── wq_brain_finalize_submissions ← 最终提交确认
│
├── Evolution Engine ← 因子进化引擎
│ ├── MutationEngine (8 方向突变)
│ ├── CrossoverEngine (高分因子交叉)
│ ├── MetaEvolutionSelector (自适应策略)
│ └── TrajectoryAnalyzer (轨迹分析)
│
├── WQ BRAIN Integration ← WorldQuant 直连
│ ├── Dollar-neutral 模拟
│ ├── IS 检测对齐
│ ├── Fitness 评分
│ └── 一键正式提交
│
└── Knowledge Base ← 跨会话知识积累
├── rules/ (已验证规则)
├── findings/ (经验发现)
└── failures/ (已证伪路径)
No comments yet. Be the first to share your thoughts!
传统工具(包括 ChatGPT + 回测库)的模式是:人类想因子 → 工具跑回测 → 人类看结果。Agent 是执行者,人类是决策者。
QuantGPT 的模式是:人类定义目标 → Agent 自治研究 → 人类审阅产出。Agent 是研究者,人类是审阅者。
这不是接口层的区别(自然语言 vs. 代码),而是决策权的区别。Agent 自主决定:探索哪个方向、生成什么表达式、评估哪些指标、何时迭代、何时放弃、何时提交。
| Metric | Value | |:-------|:------| | 累计回测任务 | 370+ | | 单轮迭代(8 候选因子) | ~15 分钟 | | 表达式算子标准 | WorldQuant BRAIN 对齐 | | BRAIN 正式提交 | 3 个因子 IS 全部 PASS,已提交(最佳 Fitness 1.26) | | WQ BRAIN 集成 | 内置 API — 一键模拟 + 自动提交 |
QuantGPT Agent 已产出 3 个正式提交因子,全部通过 WQ BRAIN IS 检测:
| Factor | Expression | WQ Sharpe | WQ Fitness | WQ Returns | IS Tests | Status |
|:-------|:-----------|:---------:|:----------:|:----------:|:--------:|:------:|
| Debt-Momentum Composite | -1 * rank(ts_av_diff(close, 10)) + rank(debt / enterprise_value) | 1.77 | 1.26 | 20.18% | ALL PASS | Submitted |
| VWAP Decay Reversal | -1 * rank(ts_decay_linear(close / vwap, 10)) | 1.69 | 1.07 | 18.63% | ALL PASS | Submitted |
| Returns-Volume Momentum | -1 * rank(ts_decay_linear(returns * volume / adv20, 5)) | 1.60 | 1.03 | 24.15% | ALL PASS | Submitted |
3 个因子代表不同的 alpha 来源:Debt-Momentum 结合动量反转与基本面(债务/企业价值),行业中性化;VWAP Decay Reversal 捕捉价格偏离 VWAP 的衰减回归,市场中性化;Returns-Volume Momentum 捕捉收益率与相对成交量的衰减动量,市场中性化。全程 Agent 自治完成。
This is QuantGPT's defining capability.
Agent 读知识库、设计假设、批量实验、分析结果、积累知识、自我迭代,每个结论经过双模型交叉验证。一个研究循环产出经过验证的、可提交 WQ BRAIN 的因子。
┌─────────────────────────────┐
│ Research Notes & Knowledge │
│ (Rules / Findings / Fails) │
└──────────┬──────────────────┘
│ read
▼
┌──────────┐ ┌──────────────────────────┐ ┌──────────────────┐
│ Phase 0 │───▶│ Phase 1: Factor Design │───▶│ Phase 2: Batch │
│ Context │ │ Hypothesis → Expression │ │ Backtest (10-20 │
│ Loading │ │ 1-3 candidates per idea │ │ concurrent) │
└──────────┘ └──────────────────────────┘ └────────┬─────────┘
│
┌─────────────────────────┘
▼
┌──────────────────────────────────────────┐
│ Phase 3: Four-Step Analysis │
│ │
│ ① Fact Collection (metrics vs baseline) │
│ ② Independent Judgment (Agent) │
│ ③ Cross-Review (DeepSeek Reasoner) │
│ ④ Consensus or Divergence Resolution │
└──────────────────┬───────────────────────┘
│
┌──────────────┴──────────────┐
▼ ▼
┌─────────────────┐ ┌──────────────────┐
│ Phase 4: Update │ │ Phase 5: Stop? │
│ Notes + Knowledge│ │ Converged / │
│ Base │◀────────│ Time / Rounds │
└─────────────────┘ └──────────────────┘
│ │ no
│ └──▶ back to Phase 1
▼
┌──────────────────┐
│ Phase 6: Report │
│ A/B factors + │
│ new knowledge │
└──────────────────┘
Dual-LLM Cross-Review
每个结论性判断(采用/不采用/关闭方向)必须经过第二个 LLM 独立评审。把事实数据和第一个模型的推理链一起发给 DeepSeek Reasoner,要求独立评估推理是否合理、是否有遗漏角度。
共识 → 直接输出。分歧 → 呈现双方证据,采用更保守结论。
这解决了单模型因子研究的核心问题:confirmation bias。
Persistent Knowledge Base
research_notes/knowledge/
├── rules/ ← 已验证的稳定规则(必须遵守)
├── findings/ ← 经验发现(参考)
└── failures/ ← 已证伪路径(禁止重复)
知识库跨会话积累。第 10 次研究会话可以直接利用前 9 次的所有发现,避免重复实验,遵守已验证规则,绕开已证伪路径。
这不是 chat history——是结构化的研究资产。
Batch Concurrent Evaluation
单次提交 10-20 个因子表达式,并发回测 + 三波重试。结果按 fitness 降序排列。hs300 fitness < 0.1 时自动跳过 csi500 验证,节省算力。
from scripts.factor_miner import batch_evaluate
results = batch_evaluate(
server, expressions, params,
max_concurrent=10
)
Research Discipline (Enforced)
不是建议,是硬性规则:
上面 Validated Results 中的因子就是这个流程的产出。 多轮迭代,3 个因子正式提交 WQ BRAIN(IS 全部通过)。完整方法论见 Factor Mining Guide。
┌────────────────────────────────────────────────────────────────────┐
│ QuantGPT Research Engine │
├─────────────┬──────────────────────────────┬───────────────────────┤
│ │ Core Engine │ │
│ Agent │ ┌──────────────────────┐ │ Data Layer │
│ Interface │ │ Expression Parser │ │ ┌─────────────────┐ │
│ │ │ 50+ operators │ │ │ baostock (free) │ │
│ MCP Tools │ │ WQ BRAIN compatible │ │ │ akshare (free) │ │
│ REST API │ └──────────┬───────────┘ │ │ PolarDB (opt) │ │
│ Web UI │ ┌──────────▼───────────┐ │ │ Parquet cache │ │
│ (monitor) │ │ Backtest Engine │ │ └─────────────────┘ │
│ │ │ Rank-based grouping │ │ │
│ │ │ WQ BRAIN aligned │ │ AI Layer │
│ │ └──────────┬───────────┘ │ ┌─────────────────┐ │
│ │ ┌──────────▼───────────┐ │ │ DeepSeek LLM │ │
│ │ │ Validation Suite │ │ │ Factor design │ │
│ │ │ Anti-overfit (4x) │ │ │ Cross-review │ │
│ │ │ Walk-forward │ │ │ Mutation engine │ │
│ │ │ WQ BRAIN simulation │ │