longbridge-factor-research
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineselongbridge-factor-research
longbridge-factor-research
A systematic framework for testing whether a quantitative factor adds predictive value for future returns — covering IC analysis, information ratio, decile portfolio construction, and factor decay.
Response language: match the user's input language — Simplified Chinese / Traditional Chinese / English.
一个用于检验量化因子是否具备未来收益预测价值的系统性框架——涵盖IC分析、信息比率、十分位组合构建以及因子衰减分析。
响应语言:匹配用户输入语言——简体中文 / 繁体中文 / 英文。
When to use
使用场景
- "帮我分析 PE 因子的 IC", "test IC for the PE factor on A-shares"
- "动量因子有效吗", "is momentum factor effective on HK stocks"
- "做个分层回测", "run a decile portfolio backtest"
- "这个因子多少期后失效", "how many periods until this factor decays"
- "IC 序列自相关怎么算", "calculate IC serial autocorrelation"
For multi-factor screening (not research), use . For ML-based strategies, use .
longbridge-factor-screenlongbridge-ml-strategy- "帮我分析 PE 因子的 IC", "test IC for the PE factor on A-shares"
- "动量因子有效吗", "is momentum factor effective on HK stocks"
- "做个分层回测", "run a decile portfolio backtest"
- "这个因子多少期后失效", "how many periods until this factor decays"
- "IC 序列自相关怎么算", "calculate IC serial autocorrelation"
若需多因子筛选(而非研究),请使用 ;若基于机器学习策略研究,请使用 。
longbridge-factor-screenlongbridge-ml-strategyWorkflow
工作流程
Step 1 — Define the factor
步骤1 — 定义因子
Clarify with the user:
- Factor name and calculation (e.g. trailing-12M PE, 1M price momentum, ROE YoY change).
- Universe: index constituent (e.g. CSI 300, HSI, S&P 500) or custom list.
- Test period (e.g. 2020-01-01 to 2024-12-31).
- Holding period (e.g. monthly rebalance).
与用户确认以下信息:
- 因子名称及计算方式(如过去12个月PE、1个月价格动量、ROE同比变化)。
- 选股范围:指数成分股(如沪深300、恒生指数、标普500)或自定义列表。
- 测试周期(如2020-01-01至2024-12-31)。
- 持有周期(如月度调仓)。
Step 2 — Fetch universe constituents
步骤2 — 获取选股范围成分股
bash
longbridge constituent --help
longbridge constituent <INDEX> --format jsonExtract the array. Common indices: (CSI 300), , .
stocks000300.SHHSI.HKSPX.USbash
longbridge constituent --help
longbridge constituent <INDEX> --format json提取数组。常用指数代码:(沪深300)、(恒生指数)、(标普500)。
stocks000300.SHHSI.HKSPX.USStep 3 — Fetch factor values and returns
步骤3 — 获取因子值与收益数据
For each symbol in the universe:
bash
longbridge calc-index <SYMBOL> --format json # valuation, growth metrics
longbridge kline <SYMBOL> --period day --count 252 --format json # price history for returnsRun on each command to verify available fields before parsing.
--help针对选股范围内的每只标的:
bash
longbridge calc-index <SYMBOL> --format json # 估值、成长指标
longbridge kline <SYMBOL> --period day --count 252 --format json # 用于计算收益的价格历史数据在解析前,可对每个命令添加参数查看可用字段。
--helpStep 4 — Compute IC at each rebalance date
步骤4 — 计算每个调仓日的IC值
IC_t = rank_correlation(factor_value_t, forward_return_t+h)Where = holding period. Use Spearman rank correlation (robust to outliers). Winsorize factor values at 1%/99% before ranking.
hIC_t = rank_correlation(factor_value_t, forward_return_t+h)其中为持有周期。采用Spearman秩相关系数(对异常值鲁棒)。在排序前需对因子值进行1%/99%分位的缩尾处理。
hStep 5 — Summary statistics
步骤5 — 汇总统计指标
| Metric | Formula | Good signal threshold |
|---|---|---|
| Mean IC | Average of IC time series | > 0.03 (positive) |
| IC Std Dev | Standard deviation of IC | Lower is better |
| IR (Information Ratio) | Mean IC / Std Dev IC | > 0.5 is promising |
| IC > 0 hit rate | % of periods IC > 0 | > 55% |
| ICIR (annualised) | IR × √(periods per year) | > 1.0 strong |
| 指标 | 计算公式 | 良好信号阈值 |
|---|---|---|
| 平均IC | IC时间序列的平均值 | > 0.03(正向) |
| IC标准差 | IC的标准差 | 越小越好 |
| IR(信息比率) | 平均IC / IC标准差 | > 0.05具备潜力 |
| IC>0命中率 | IC>0的周期占比 | > 55% |
| 年化ICIR | IR × √(每年周期数) | > 1.0表现强劲 |
Step 6 — Decile portfolio backtest
步骤6 — 十分位组合回测
- At each rebalance date, sort universe into 10 deciles by factor value.
- Track equal-weighted returns for each decile over the holding period.
- Key output: decile 1 vs decile 10 spread (long-short portfolio return).
- Compute cumulative return, Sharpe ratio, and max drawdown for the long-short portfolio.
- 在每个调仓日,按因子值将选股范围分为10个十分位组。
- 跟踪每个十分位组在持有周期内的等权重收益。
- 核心输出:第1组与第10组的收益差(多空组合收益)。
- 计算多空组合的累计收益、夏普比率及最大回撤。
Step 7 — IC decay analysis
步骤7 — IC衰减分析
Compute IC for multiple forward horizons (1M, 2M, 3M, 6M, 12M). Plot IC vs horizon. Fast decay = short-term factor; slow decay = longer-term signal.
Serial autocorrelation of IC series: . High autocorrelation → smoother signal, lower trading cost.
autocorr(IC, lag=1)计算多个远期期限(1个月、2个月、3个月、6个月、12个月)的IC值,绘制IC与期限的关系图。衰减快代表短期因子;衰减慢代表长期信号。
IC序列的自相关:。高自相关性意味着信号更平滑,交易成本更低。
autocorr(IC, lag=1)CLI
命令行工具(CLI)
bash
longbridge constituent --help
longbridge calc-index --help
longbridge kline --help
longbridge constituent <INDEX> --format json
longbridge calc-index <SYMBOL> --format json
longbridge kline <SYMBOL> --period day --count 252 --format jsonbash
longbridge constituent --help
longbridge calc-index --help
longbridge kline --help
longbridge constituent <INDEX> --format json
longbridge calc-index <SYMBOL> --format json
longbridge kline <SYMBOL> --period day --count 252 --format jsonOutput
输出内容
Present:
- Factor definition and universe summary.
- IC time series chart (describe in text if no chart tool).
- Summary statistics table (Mean IC, IC Std Dev, IR, hit rate).
- Decile return bar chart description (decile 1 to 10 cumulative return).
- IC decay table across horizons.
- Interpretation: is the factor effective? Recommended holding period?
需呈现:
- 因子定义及选股范围汇总。
- IC时间序列图表(若无绘图工具则用文字描述)。
- 汇总统计表格(平均IC、IC标准差、IR、命中率)。
- 十分位收益柱状图描述(第1至10组累计收益)。
- 不同期限下的IC衰减表格。
- 解读:因子是否有效?推荐持有周期?
Error handling
错误处理
| Situation | 简体回复 | 繁體回覆 | English reply |
|---|---|---|---|
| 请安装 longbridge-terminal 或检查 MCP 配置。 | 請安裝 longbridge-terminal 或檢查 MCP 配置。 | Install longbridge-terminal or check MCP config. |
stderr: | 请运行 | 請執行 | Run |
| Index not found | 请检查指数代码格式,如 000300.SH / HSI.HK / SPX.US。 | 請確認指數代碼,如 000300.SH / HSI.HK / SPX.US。 | Check index ticker format, e.g. 000300.SH / HSI.HK / SPX.US. |
| Insufficient history | 该标的历史数据不足以进行回测,请缩短测试期或更换标的。 | 歷史數據不足,請縮短測試期或更換標的。 | Insufficient price history; shorten the test period or change the symbol. |
| 场景 | 简体回复 | 繁體回覆 | English reply |
|---|---|---|---|
| 请安装 longbridge-terminal 或检查 MCP 配置。 | 請安裝 longbridge-terminal 或檢查 MCP 配置。 | Install longbridge-terminal or check MCP config. |
stderr: | 请运行 | 請執行 | Run |
| Index not found | 请检查指数代码格式,如 000300.SH / HSI.HK / SPX.US。 | 請確認指數代碼,如 000300.SH / HSI.HK / SPX.US。 | Check index ticker format, e.g. 000300.SH / HSI.HK / SPX.US. |
| Insufficient history | 该标的历史数据不足以进行回测,请缩短测试期或更换标的。 | 歷史數據不足,請縮短測試期或更換標的。 | Insufficient price history; shorten the test period or change the symbol. |
Related skills
相关技能
- — screen stocks by factor values today
longbridge-factor-screen - — combine multiple factors into a composite score
longbridge-multifactor - — statistical tests (IC significance, t-test)
longbridge-quant-stats - — machine-learning based strategy research
longbridge-ml-strategy
- — 按当前因子值筛选股票
longbridge-factor-screen - — 将多个因子组合成综合评分
longbridge-multifactor - — 统计检验(IC显著性、t检验)
longbridge-quant-stats - — 基于机器学习的策略研究
longbridge-ml-strategy
File layout
文件结构
skills/longbridge-factor-research/
└── SKILL.mdskills/longbridge-factor-research/
└── SKILL.md