longbridge-portfolio-diagnosis
Prompt-only analysis skill. Pulls live account data and recent price history to give a comprehensive portfolio health-check: concentration, sector mix, currency breakdown, factor tilt, cross-holding correlation, and benchmark deviation.
Response language: match the user's input language — Simplified Chinese / Traditional Chinese / English.
When to use
- "帮我诊断一下我的组合" / "組合診斷" / "diagnose my portfolio"
- "我的持仓集中度高吗" / "持倉集中度高嗎" / "check concentration risk"
- "行业分布怎么样" / "行業分布" / "sector distribution in my holdings"
- "货币风险怎么样" / "貨幣敞口" / "currency exposure breakdown"
- "因子暴露分析" / "factor exposure analysis"
- "持仓之间相关性" / "correlation risk across holdings"
Workflow
- Fetch account data with
longbridge portfolioandlongbridge positions. - For correlation analysis, fetch 60-day daily kline for each holding concurrently.
- Compute diagnostics in the LLM (see Calculations section).
- Present a structured diagnosis report.
CLI
Run longbridge <subcommand> --help to verify exact flags before calling.
# Step 1: account summary + positions
longbridge portfolio --format json
longbridge positions --format json
# Step 2: 60-day price history for each holding (run concurrently per symbol)
longbridge kline <SYMBOL> --period day --count 60 --format json
# Step 3: sector/valuation context per holding
longbridge calc-index <SYMBOL> --format json
Calculations
Compute the following in the LLM from fetched data:
| Metric | Method |
|---|---|
| Top-5 concentration | Sum of top-5 positions by market value ÷ total portfolio value |
| Sector distribution | Group positions by industry / sector field; compute % of total MV |
| Currency exposure | Group by currency of listing; compute % of total MV |
| Factor tilt | Large-cap (market cap > $10B) vs small-cap; PE < 15 / dividend yield > 3% = value tilt |
| Pairwise correlation | Pearson correlation of 60-day daily returns; flag pairs with r > 0.8 as high correlation |
| Benchmark deviation | If user provides a benchmark (e.g. SPX, HSI), compare sector weights |
Output template
Portfolio Diagnosis — Source: Longbridge Securities
Date: <today>
[Concentration]
- Top-5 holdings: <names> = <N>% of portfolio
- Risk: {Low (<40%) / Medium (40-60%) / High (>60%)}
[Sector Distribution]
- <Sector>: <N>% (target suggestion if heavily concentrated)
- ...
[Currency Exposure]
- USD: <N>% HKD: <N>% CNY: <N>% Other: <N>%
[Factor Tilt]
- Large-cap: <N>% Small-cap: <N>%
- Value tilt: <N>% Growth tilt: <N>%
[Correlation Risk]
- High-correlation pairs (r > 0.8): <list>
- Diversification note: ...
[Summary & Suggestions]
- Key risks: ...
- Suggested actions: ...
⚠️ 仅供参考,不构成投资建议。/ 僅供參考,不構成投資建議。/ For reference only. Not investment advice.
Error handling
| Situation | 简体回复 | 繁體回復 | English reply |
|---|---|---|---|
command not found: longbridge | 回退到 MCP;若也不可用,请安装 longbridge-terminal | 回退到 MCP;若也不可用,請安裝 longbridge-terminal | Fall back to MCP; if unavailable, ask user to install longbridge-terminal. |
stderr not logged in | 请运行 longbridge auth login 登录 | 請運行 longbridge auth login 登入 | Run longbridge auth login to authenticate. |
| Empty positions | 账户暂无持仓,无法诊断 | 賬戶暫無持倉,無法診斷 | No holdings found; cannot run diagnosis. |
| kline data unavailable for a symbol | 跳过该标的相关性计算,标注数据缺失 | 略過該標的相關性計算,標注數據缺失 | Skip correlation for that symbol; note data gap. |
MCP fallback
If longbridge CLI is not installed, use MCP tools:
When the CLI is unavailable, fall back to the MCP server. Discover available tools from the MCP server's tool list at runtime — do not rely on hardcoded tool names.
MCP setup: claude mcp add --transport http longbridge https://openapi.longbridge.com/mcp (quote + trade_read scopes).
Related skills
- Rebalance to target weights →
longbridge-portfolio-rebalance - Risk metrics (VaR, drawdown) →
longbridge-risk-analysis - Asset allocation framework →
longbridge-asset-allocation - Portfolio P&L overview →
longbridge-portfolio
File layout
longbridge-portfolio-diagnosis/
└── SKILL.md # prompt-only, no scripts/