longbridge-performance-attribution
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineselongbridge-performance-attribution
longbridge-performance-attribution
Decomposes a portfolio's return into attributable components using Brinson-Hood-Beebower sector attribution and multi-factor regression. Answers: "did I add value through industry allocation or stock selection?" and "how much of my alpha is market beta vs true skill?".
Response language: match the user's input language — Simplified Chinese / Traditional Chinese / English.
通过Brinson-Hood-Beebower行业归因法和多因子回归,将投资组合的收益拆解为可归因的组成部分。可解答如下问题:“我的收益增值来自行业配置还是个股选择?”以及“我的α中有多少来自市场β,多少来自真实投资能力?”
响应语言:匹配用户输入语言——简体中文/繁体中文/英文。
When to use
使用场景
- User wants to understand the sources of their portfolio P&L: "我的超额收益来自哪里", "是选股好还是配置好", "performance attribution AAPL TSLA", "我的 alpha 来源".
- Requires Longbridge login with Trade scope to read positions.
- 用户希望了解投资组合盈亏(P&L)的来源:例如“我的超额收益来自哪里”、“是选股好还是配置好”、“performance attribution AAPL TSLA”、“我的 alpha 来源”。
- 需要具备Trade权限的长桥(Longbridge)账号登录以读取持仓信息。
Workflow
工作流程
- Fetch portfolio positions:
longbridge positions --format json - Fetch portfolio P&L:
longbridge portfolio --format json - Fetch benchmark daily candles (default: SPX.US for US, HSI.HK for HK, 000300.SH for CN):
longbridge kline <BENCHMARK> --period day --count 252 --format json - Fetch each position's daily candles (up to 10 positions; skip if > 10, note limitation):
longbridge kline <SYMBOL> --period day --count 252 --format json - Brinson Attribution (use current weights from positions; group by industry):
- Allocation effect = (w_p,i − w_b,i) × (r_b,i − r_b)
- Selection effect = w_b,i × (r_p,i − r_b,i)
- Interaction = (w_p,i − w_b,i) × (r_p,i − r_b,i)
- Total active return = sum of all three
- Factor decomposition (OLS regression of portfolio excess return on factors):
- Market: (r_benchmark − r_f)
- Momentum: (60-day return rank)
- Report α (intercept), β_market, with t-stats
- Timing (T-M model): regress portfolio excess return on (r_b − r_f) + (r_b − r_f)²; γ > 0 indicates positive timing ability.
Run and to verify current flag names.
longbridge positions --helplongbridge portfolio --help- 获取投资组合持仓:
longbridge positions --format json - 获取投资组合盈亏:
longbridge portfolio --format json - 获取基准指数日K线数据(默认:美股为SPX.US,港股为HSI.HK,A股为000300.SH):
longbridge kline <BENCHMARK> --period day --count 252 --format json - 获取每只持仓标的的日K线数据(最多支持10只持仓;若超过10只则跳过,请注意此限制):
longbridge kline <SYMBOL> --period day --count 252 --format json - Brinson归因分析(使用持仓当前权重;按行业分组):
- 配置效应 = (w_p,i − w_b,i) × (r_b,i − r_b)
- 选股效应 = w_b,i × (r_p,i − r_b,i)
- 交互效应 = (w_p,i − w_b,i) × (r_p,i − r_b,i)
- 总主动收益 = 上述三者之和
- 因子分解(投资组合超额收益对因子的OLS回归):
- 市场因子:(r_benchmark − r_f)
- 动量因子:(60日收益率排名)
- 输出α(截距项)、市场β,以及t统计量
- 择时能力分析(T-M模型):将投资组合超额收益对(r_b − r_f) + (r_b − r_f)²进行回归;若γ > 0则表明具备正向择时能力。
运行和以确认当前命令参数名称。
longbridge positions --helplongbridge portfolio --helpCLI
命令行界面(CLI)
bash
longbridge positions --help
longbridge portfolio --help
longbridge kline --help
longbridge positions --format json
longbridge portfolio --format json
longbridge kline <BENCHMARK> --period day --count 252 --format json
longbridge kline <SYMBOL> --period day --count 252 --format jsonbash
longbridge positions --help
longbridge portfolio --help
longbridge kline --help
longbridge positions --format json
longbridge portfolio --format json
longbridge kline <BENCHMARK> --period day --count 252 --format json
longbridge kline <SYMBOL> --period day --count 252 --format jsonOutput
输出内容
| Component | 简体 | 繁體 | English |
|---|---|---|---|
| Allocation effect | 配置效应 | 配置效應 | Allocation effect |
| Selection effect | 选股效应 | 選股效應 | Selection effect |
| Interaction effect | 交互效应 | 交互效應 | Interaction effect |
| Market beta | 市场β | 市場β | Market β |
| Alpha (Jensen) | 超额收益α | 超額收益α | Jensen α |
| Timing ability γ | 择时系数 | 擇時係數 | Timing coefficient γ |
Output: Brinson table by industry → factor decomposition → timing verdict → 3-sentence interpretive summary. Cite Longbridge Securities / 数据来源:长桥证券 / 數據來源:長橋證券.
| Component | 简体 | 繁體 | English |
|---|---|---|---|
| Allocation effect | 配置效应 | 配置效應 | Allocation effect |
| Selection effect | 选股效应 | 選股效應 | Selection effect |
| Interaction effect | 交互效应 | 交互效應 | Interaction effect |
| Market beta | 市场β | 市場β | Market β |
| Alpha (Jensen) | 超额收益α | 超額收益α | Jensen α |
| Timing ability γ | 择时系数 | 擇時係數 | Timing coefficient γ |
输出内容顺序:按行业划分的Brinson归因表 → 因子分解结果 → 择时能力结论 → 三句解读总结。需标注Longbridge Securities / 数据来源:长桥证券 / 數據來源:長橋證券。
Error handling
错误处理
| Situation | 简体回复 | 繁體回復 | English reply |
|---|---|---|---|
| 回退到 MCP 或提示安装 longbridge-terminal | 回退到 MCP 或提示安裝 longbridge-terminal | Fall back to MCP or install longbridge-terminal |
| 请运行 | 請執行 | Run |
| Empty positions | 账户暂无持仓,无法归因 | 賬戶暫無持倉 | No positions found; nothing to attribute |
| > 10 positions | 持仓超过10只,仅归因前10大持仓 | 持倉超過10只 | Attribution limited to top-10 positions |
| Other stderr | 直接显示原始错误 | 直接顯示原始錯誤 | Surface verbatim |
| Situation | 简体回复 | 繁體回復 | English reply |
|---|---|---|---|
| 回退到 MCP 或提示安装 longbridge-terminal | 回退到 MCP 或提示安裝 longbridge-terminal | Fall back to MCP or install longbridge-terminal |
| 请运行 | 請執行 | Run |
| Empty positions | 账户暂无持仓,无法归因 | 賬戶暫無持倉 | No positions found; nothing to attribute |
| > 10 positions | 持仓超过10只,仅归因前10大持仓 | 持倉超過10只 | Attribution limited to top-10 positions |
| Other stderr | 直接显示原始错误 | 直接顯示原始錯誤 | Surface verbatim |
MCP fallback
MCP fallback方案
- for holdings;
mcp__longbridge__positionsfor price series when CLI is unavailable.mcp__longbridge__candlesticks
- 当CLI不可用时,使用获取持仓数据;使用
mcp__longbridge__positions获取价格序列数据。mcp__longbridge__candlesticks
Related skills
相关技能
- — P&L curve and account-level summary
longbridge-portfolio - — raw holdings
longbridge-positions - — factor model for stock selection
longbridge-multifactor - — covariance matrix for factor decomposition
longbridge-correlation
- — 盈亏曲线与账户级汇总
longbridge-portfolio - — 原始持仓数据
longbridge-positions - — 用于选股的因子模型
longbridge-multifactor - — 用于因子分解的协方差矩阵
longbridge-correlation
File layout
文件结构
longbridge-performance-attribution/
└── SKILL.mdlongbridge-performance-attribution/
└── SKILL.md