longbridge-portfolio-rebalance
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineselongbridge-portfolio-rebalance
longbridge-portfolio-rebalance
Prompt-only analysis skill. Compares current portfolio weights against user-provided target weights, computes drift, and produces a prioritised rebalance trade list with estimated transaction costs. Read-only — does not place orders.
Response language: match the user's input language — Simplified Chinese / Traditional Chinese / English.
仅基于提示词的分析技能。将当前投资组合权重与用户提供的目标权重进行对比,计算权重偏移,并生成带有预估交易成本的优先级再平衡交易清单。仅支持读取操作——不执行下单。
回复语言:匹配用户输入语言——简体中文 / 繁体中文 / 英文。
When to use
使用场景
- "帮我做一下组合再平衡" / "組合再平衡" / "rebalance my portfolio"
- "我的仓位偏移了,怎么调整" / "倉位偏移了" / "my weights have drifted, what should I trade"
- "目标权重 AAPL 30% TSLA 20% 现金 50%,帮我生成交易清单"
- "哪些仓位需要减持,哪些需要加仓" / "rebalance trades list"
- "帮我做一下组合再平衡" / "組合再平衡" / "rebalance my portfolio"
- "我的仓位偏移了,怎么调整" / "倉位偏移了" / "my weights have drifted, what should I trade"
- "目标权重 AAPL 30% TSLA 20% 现金 50%,帮我生成交易清单"
- "哪些仓位需要减持,哪些需要加仓" / "rebalance trades list"
Workflow
工作流程
- Fetch current positions and total portfolio value.
- Ask user for target weights if not provided (symbol → target % pairs).
- Fetch current prices for all symbols.
- Compute current weights and drift vs target.
- Generate trade list: symbols to buy (underweight) and sell (overweight).
- Estimate transaction cost (brokerage fee ~0.03–0.1% per trade; note tax impact for gains).
- Present trade list sorted by drift magnitude (largest first).
- 获取当前持仓和投资组合总价值。
- 若未提供目标权重,询问用户(标的→目标占比配对)。
- 获取所有标的的当前价格。
- 计算当前权重及与目标权重的偏移值。
- 生成交易清单:需加仓(权重不足)和需减仓(权重超标)的标的。
- 预估交易成本(佣金约为每笔交易的0.03–0.1%;注意收益的税务影响)。
- 按偏移幅度从大到小排序展示交易清单。
CLI
CLI
Run to verify exact flags before calling.
longbridge <subcommand> --helpbash
undefined调用前运行 确认具体参数。
longbridge <subcommand> --helpbash
undefinedCurrent holdings and portfolio value
当前持仓和投资组合价值
longbridge portfolio --format json
longbridge positions --format json
longbridge portfolio --format json
longbridge positions --format json
Current prices for each symbol in portfolio or target list (run concurrently)
投资组合或目标列表中每个标的的当前价格(并发运行)
longbridge quote <SYMBOL> --format json
longbridge quote <SYMBOL> --format json
Maximum tradeable quantity (optional, for feasibility check)
最大可交易数量(可选,用于可行性检查)
longbridge max-qty <SYMBOL> --format json
undefinedlongbridge max-qty <SYMBOL> --format json
undefinedCalculations
计算方式
| Quantity | Method |
|---|---|
| Current weight | Position MV ÷ Total portfolio MV |
| Target MV | Total portfolio MV × target weight % |
| Required trade | Target MV − Current MV (positive = buy, negative = sell) |
| Trade quantity | Required trade amount ÷ current price (round to lot size) |
| Drift threshold | Flag if |
| Est. cost | Trade amount × 0.05% (configurable; note this is approximate) |
| 指标 | 计算方法 |
|---|---|
| 当前权重 | 持仓市值 ÷ 投资组合总市值 |
| 目标市值 | 投资组合总市值 × 目标权重占比 |
| 所需交易金额 | 目标市值 − 当前市值(正数=买入,负数=卖出) |
| 交易数量 | 所需交易金额 ÷ 当前价格(按手数取整) |
| 偏移阈值 | 若 |
| 预估成本 | 交易金额 × 0.05%(可配置;此为近似值) |
Output template
输出模板
Portfolio Rebalance Plan — Source: Longbridge Securities
Total Portfolio Value: <MV> <currency>
Date: <today>
[Current vs Target Weights]
Symbol Current% Target% Drift Action Qty Est.Cost
AAPL.US 35.2% 30.0% +5.2% SELL 12 $1,840 ~$0.9
TSLA.US 12.1% 20.0% -7.9% BUY 8 $2,100 ~$1.1
CASH 52.7% 50.0% +2.7% — — —
[Trade Summary]
- Total buys: $X,XXX (~$X.XX in fees)
- Total sells: $X,XXX (~$X.XX in fees)
- Net cash change: ±$XXX
[Notes]
- Positions within ±5% of target weight are within tolerance and need no action.
- Sell orders on positions with unrealised gains may trigger tax events (US investors).
- Review lot sizes for HK/A-share stocks before placing orders.
⚠️ 仅供参考,不构成投资建议,请自行决策下单。/ 僅供參考,不構成投資建議,請自行決策下單。/ For reference only. Not investment advice. Place orders at your own discretion.投资组合再平衡方案 — 来源:Longbridge Securities
投资组合总价值:<MV> <货币>
日期:<今日>
[当前权重 vs 目标权重]
标的 当前占比 目标占比 偏移值 操作 数量 预估成本
AAPL.US 35.2% 30.0% +5.2% 卖出 12 $1,840 ~$0.9
TSLA.US 12.1% 20.0% -7.9% 买入 8 $2,100 ~$1.1
现金 52.7% 50.0% +2.7% — — —
[交易汇总]
- 总买入金额: $X,XXX (~$X.XX 手续费)
- 总卖出金额: $X,XXX (~$X.XX 手续费)
- 净现金变动: ±$XXX
[注意事项]
- 目标权重±5%范围内的持仓属于可容忍范围,无需操作。
- 对未实现收益的持仓下达卖出指令可能触发税务事件(美国投资者)。
- 下单前请确认港股/A股的手数规则。
⚠️ 仅供参考,不构成投资建议,请自行决策下单。/ 僅供參考,不構成投資建議,請自行決策下單。/ For reference only. Not investment advice. Place orders at your own discretion.Error handling
错误处理
| Situation | 简体回复 | 繁體回復 | English reply |
|---|---|---|---|
| 回退到 MCP;若也不可用,请安装 longbridge-terminal | 回退到 MCP;若也不可用,請安裝 longbridge-terminal | Fall back to MCP; if unavailable, install longbridge-terminal. |
stderr | 请运行 | 請運行 | Run |
| No target weights provided | 请告知目标配置,例如:AAPL 30%、TSLA 20%、现金 50% | 請告知目標配置,例如:AAPL 30%、TSLA 20%、現金 50% | Please provide target weights, e.g. AAPL 30%, TSLA 20%, cash 50%. |
| Quote unavailable for a symbol | 跳过该标的,标注价格数据缺失 | 略過該標的,標注價格數據缺失 | Skip that symbol; note price data is unavailable. |
| 场景 | 简体回复 | 繁体回复 | English reply |
|---|---|---|---|
| 回退到 MCP;若也不可用,请安装 longbridge-terminal | 回退到 MCP;若也不可用,請安裝 longbridge-terminal | Fall back to MCP; if unavailable, install longbridge-terminal. |
stderr | 请运行 | 請運行 | Run |
| 未提供目标权重 | 请告知目标配置,例如:AAPL 30%、TSLA 20%、现金 50% | 請告知目標配置,例如:AAPL 30%、TSLA 20%、現金 50% | Please provide target weights, e.g. AAPL 30%, TSLA 20%, cash 50%. |
| 某标的价格数据不可用 | 跳过该标的,标注价格数据缺失 | 略過該標的,標注價格數據缺失 | Skip that symbol; note price data is unavailable. |
MCP fallback
MCP 回退方案
If CLI is not installed, use MCP tools:
longbridge| MCP tool | CLI equivalent |
|---|---|
| |
| |
| |
MCP setup: ( + scopes).
claude mcp add --transport http longbridge https://openapi.longbridge.com/mcpquotetrade_read若未安装 CLI,使用 MCP 工具:
longbridge| MCP 工具 | CLI 等效命令 |
|---|---|
| |
| |
| |
MCP 设置:(需 + 权限)。
claude mcp add --transport http longbridge https://openapi.longbridge.com/mcpquotetrade_readRelated skills
相关技能
- Portfolio health-check →
longbridge-portfolio-diagnosis - Asset allocation frameworks →
longbridge-asset-allocation - Risk metrics →
longbridge-risk-analysis - Place orders → use Longbridge app/terminal directly
- 投资组合健康检查 →
longbridge-portfolio-diagnosis - 资产配置框架 →
longbridge-asset-allocation - 风险指标 →
longbridge-risk-analysis - 下单操作 → 直接使用 Longbridge 应用/终端
File layout
文件结构
longbridge-portfolio-rebalance/
└── SKILL.md # prompt-only, read-only — no order placementlongbridge-portfolio-rebalance/
└── SKILL.md # 仅基于提示词,仅支持读取——不执行下单