factor-research
它能做什么
这项技能在一组标的中评估股票因子,并检查哪些因子真正具有预测能力。适合希望筛选因子并组合其中优秀因子的量化分析师。
适用场景
- ✓当你想检验某一个因子(例如动量或价值)能否预测收益的时候。
- ✓当你想为组合多个因子选择权重的时候。
- ✓当你想了解在不同持有期下,因子的预测能力衰减得有多快的时候。
技能链接
https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/factor-research/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请检验动量和价值因子能否预测这份股票清单的收益,并告诉我哪一个值得组合使用。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会计算每个因子的数值以及每只股票的未来收益,然后运行因子分析工具,计算 IC 和 IR 统计以及分位数回测。它会根据这些结果判断每个因子的有效性,并建议如何组合表现强的因子。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Factor Research Framework
Purpose
Systematically evaluates the predictive power of single or multiple factors. Uses IC/IR statistical tests and quantile backtests to determine whether a factor has stock-selection power, and to guide factor screening and combination.
Applicable scenarios:
- Single-factor validity testing (momentum, value, quality, volatility, and more)
- Determining weights for multi-factor combination
- Factor decay analysis (IC changes across different holding periods)
- Comparing factor differences across industries and markets
Workflow
- Calculate factor values: compute factor exposures for each instrument on the cross-section, and output a factor CSV (
index=date,columns=codes) - Calculate returns: compute each instrument's forward N-day return, and output a return CSV (same structure)
- Call the
factor_analysistool: pass in the factor CSV, return CSV, and output directory - Interpret the results: judge factor validity based on IC/IR criteria and quantile backtest results
- Factor screening / combination: keep effective factors and combine them with equal weights or IC-based weights
Key point: the rows (dates) and columns (instrument codes) of the factor CSV and return CSV must align exactly. Returns must be forward returns after the factor-observation date (to avoid look-ahead bias).
factor_analysis Tool Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| factor_csv | string | Yes | - | Path to the factor-value CSV |
| return_csv | string | Yes | - | Path to the return CSV |
| output_dir | string | Yes | - | Output directory for results |
| n_groups | integer | No | 5 | Number of quantile groups |
Output Files
| File | Contents |
|---|---|
| ic_series.csv | Daily IC series |
| ic_summary.json | IC mean, IC standard deviation, IR, proportion of IC > 0 |
| group_equity.csv | Cumulative equity curves for each quantile group |
IC/IR Interpretation Standards
| Metric | Threshold | Interpretation |
|---|---|---|
| IC mean | > 0.03 | Factor has basic predictive power |
| IC mean | > 0.05 | Factor has strong predictive power |
| IC mean | > 0.10 | Unusually high; check for look-ahead bias |
| IR (IC mean / IC std) | > 0.5 | Factor is stably effective |
| IR | > 1.0 | Extremely strong, very rare |
| Proportion of IC > 0 | > 55% | Factor direction is stable |
| Proportion of IC > 0 | < 50% | Factor direction is unstable and unusable |
Note: negative IC can also be useful (reverse factors). Judge by absolute value, and reverse the signal direction in actual use.
Quantile Backtest Interpretation
Quantile backtesting sorts instruments into N groups by factor value from low to high (default 5 groups), with equal-weight holding inside each group.
Criteria:
- Monotonicity: the final net values from
Group_1toGroup_Nshould show a monotonic rising (or falling) pattern. Better monotonicity means stronger factor discrimination - Long-short spread: the net-value difference between the highest and lowest group (
long_short_spread). A larger spread means stronger selection power - Nonlinearity: if only the top and bottom groups differ materially while the middle groups are similar, the factor may only be effective in the tails
- Stability: group equity curves should be smooth; sharp swings indicate an unstable factor
Warning signs:
- No meaningful difference across group equity curves → the factor is ineffective
- Non-monotonic pattern (such as V-shape or inverted V-shape) → the factor may have a nonlinear relationship and requires further analysis
- One group's net value falls persistently → the factor may be usable in reverse
Factor Combination Methods
When multiple single factors pass validity tests, they should be combined into a composite factor:
Equal-Weight Combination
The simplest method: standardize each factor and sum them with equal weights. Suitable when the factor count is small and IC differences are minor.
Composite factor = Z(factor1) + Z(factor2) + ... + Z(factorN)
where Z() is cross-sectional Z-score standardization
IC-Weighted Combination
Assign weights according to historical IC mean. Factors with higher IC receive larger weights.
weight_i = |IC_mean_i| / sum(|IC_mean_j|)
Composite factor = sum(weight_i * Z(factor_i))
Orthogonalized Combination
First orthogonalize the factors with the Schm
常见问题
IC 衡量的是什么?
衡量因子对股票的排名与这些股票之后收益排名的吻合程度。
为什么收益必须是向前看的?
如果使用因子日期之前的收益,就会产生前视偏差,使检验结果不可靠。
因子可以组合吗?
可以。该技能涵盖等权重以及基于 IC 的加权方法,用于组合有效的因子。
详情
作者的原始描述
Factor research framework with IC/IR analysis, quantile backtesting, and factor combination. Suitable for cross-sectional factor evaluation across multiple instruments.
repo: HKUDS/Vibe-Trading
热度
- GitHub 星标
- 37k
- 排名
- #7519
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …