longbridge-tax-harvesting
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineselongbridge-tax-harvesting
longbridge-tax-harvesting
Prompt-only analysis skill. Scans account positions for unrealised losses, calculates the potential tax saving from harvesting each loss, flags wash-sale risk, and suggests economically-similar substitute securities. Applies to US-listed securities only (US tax rules). Read-only — does not place orders.
Response language: match the user's input language — Simplified Chinese / Traditional Chinese / English.
仅基于提示词的分析技能。扫描账户持仓以识别未实现亏损,计算变现每笔亏损的潜在节税额,标记洗售风险,并推荐经济属性相似的替代证券。仅适用于美股(遵循美国税务规则)。仅可读——不进行下单操作。
回复语言:匹配用户输入语言——简体中文 / 繁体中文 / 英文。
When to use
使用场景
- "帮我做税损收割分析" / "稅損收割分析" / "tax-loss harvesting analysis"
- "哪些持仓可以锁定亏损来节税" / "哪些持倉可以節稅" / "which positions can I harvest for tax losses"
- "wash sale 规则是什么" / "wash sale 規則" / "explain wash sale rule"
- "年末税务规划" / "年末稅務規劃" / "year-end tax planning"
- "帮我做税损收割分析" / "稅損收割分析" / "tax-loss harvesting analysis"
- "哪些持仓可以锁定亏损来节税" / "哪些持倉可以節稅" / "which positions can I harvest for tax losses"
- "wash sale 规则是什么" / "wash sale 規則" / "explain wash sale rule"
- "年末税务规划" / "年末稅務規劃" / "year-end tax planning"
Important Notes
重要说明
- US tax rules only: wash-sale rule (IRS Section 1091) applies to US investors trading US-listed securities. Not applicable to HK, A-share, or other markets without equivalent rules.
- Requires Trade permission: cost basis data requires with Trade scope.
longbridge auth login - Not tax advice: always consult a qualified tax professional before executing.
- 仅适用于美国税务规则:洗售规则(美国国税局第1091条)适用于交易美股的美国投资者。不适用于港股、A股或其他无类似规则的市场。
- 需要交易权限:获取成本基准数据需通过登录并授予Trade权限。
longbridge auth login - 不构成税务建议:执行操作前请务必咨询合格税务专业人士。
Workflow
工作流程
- Fetch all positions including cost basis (average cost).
- Fetch current prices for all positions.
- Compute unrealised gain/loss per position.
- Filter to positions with unrealised losses.
- For each loss position, compute potential tax saving (loss × estimated marginal tax rate).
- Flag wash-sale risk (any purchase of the same or substantially-identical security within 30 days before or after the sale).
- Suggest substitute securities that maintain similar market exposure.
- Rank opportunities by tax saving magnitude.
- 获取包含成本基准(平均成本)的所有持仓。
- 获取所有持仓的当前价格。
- 计算每笔持仓的未实现盈亏。
- 筛选出存在未实现亏损的持仓。
- 针对每笔亏损持仓,计算潜在节税额(亏损额 × 预估边际税率)。
- 标记洗售风险(出售前后30天内是否购买过相同或实质相同的证券)。
- 推荐能维持相似市场敞口的替代证券。
- 按节税额大小排序机会。
CLI
CLI
Run to verify exact flags before calling.
longbridge <subcommand> --helpbash
undefined调用前请运行确认具体参数。
longbridge <subcommand> --helpbash
undefinedPositions with cost basis
包含成本基准的持仓
longbridge positions --format json
longbridge positions --format json
Current prices (run concurrently for each symbol)
当前价格(为每个代码并行运行)
longbridge quote <SYMBOL> --format json
undefinedlongbridge quote <SYMBOL> --format json
undefinedCalculations
计算方式
| Quantity | Method |
|---|---|
| Unrealised loss | (Current price − Average cost) × Quantity |
| Tax saving estimate | |
| Holding period | Today − position open date (if available); classify short-term (<1yr) or long-term (≥1yr) |
| Wash-sale window | 30 days before + 30 days after the sale date |
| 指标 | 计算方法 |
|---|---|
| 未实现亏损 | (当前价格 − 平均成本) × 持仓数量 |
| 预估节税额 | |
| 持有期限 | 今日 − 持仓开仓日期(若有数据);分为短期(<1年)或长期(≥1年) |
| 洗售窗口期 | 出售日前30天 + 出售日后30天 |
Substitute Securities
替代证券
When suggesting substitutes to avoid wash-sale, recommend securities that are economically similar but not "substantially identical":
| Original | Example substitute (same sector, different issuer) |
|---|---|
| AAPL (tech) | MSFT, GOOGL, or a tech ETF like QQQ |
| SPY (S&P 500 ETF) | IVV or VOO (different fund family) |
| XOM (energy) | CVX, SLB, or XLE ETF |
| Individual stock | Sector ETF covering the same industry |
Always note that substitute suitability depends on investor-specific factors; these are illustrative only.
为规避洗售规则推荐替代证券时,需选择经济属性相似但并非“实质相同”的证券:
| 原证券 | 替代证券示例(同行业,不同发行方) |
|---|---|
| AAPL(科技) | MSFT、GOOGL,或科技ETF如QQQ |
| SPY(标普500 ETF) | IVV或VOO(不同基金家族) |
| XOM(能源) | CVX、SLB,或XLE ETF |
| 个股 | 覆盖同一行业的行业ETF |
请注意,替代证券的适用性取决于投资者的具体情况;以上仅为示例。
Output template
输出模板
Tax-Loss Harvesting Analysis — Source: Longbridge Securities
Date: <today> Account: US Securities
[Positions with Unrealised Losses]
Symbol Cost Basis Current Price Unreal. Loss Hold Period Tax Saving Est.
TSLA.US $280.00 $210.00 −$7,000 8 months ~$2,590 (37% rate)
XOM.US $120.00 $108.00 −$1,200 14 months ~$240 (20% rate)
[Harvest Recommendations (ranked by tax saving)]
1. TSLA.US Sell → realise −$7,000 loss → estimated tax saving ~$2,590
Substitute: RIVN.US / LCID.US / DRIV ETF (avoid repurchasing TSLA for 30 days)
⚠️ Wash-sale risk if TSLA was purchased in last 30 days
2. XOM.US Sell → realise −$1,200 loss → estimated tax saving ~$240
Substitute: CVX.US or XLE ETF
[Wash-Sale Warnings]
- Check recent purchase dates; do not repurchase within 30 days of sale.
- Purchasing a call option on the sold stock may also trigger wash-sale.
⚠️ 本分析仅供参考,不构成税务建议。请咨询持牌税务顾问。/ 本分析僅供參考,不構成稅務建議。請諮詢持牌稅務顧問。/ For reference only. Not tax advice. Consult a qualified tax professional.税损收割分析 — 来源:Longbridge Securities
日期:<今日> 账户:美股证券
[存在未实现亏损的持仓]
代码 成本基准 当前价格 未实现亏损 持有期限 预估节税额
TSLA.US $280.00 $210.00 −$7,000 8个月 ~$2,590(37%税率)
XOM.US $120.00 $108.00 −$1,200 14个月 ~$240(20%税率)
[收割建议(按节税额排序)]
1. TSLA.US 卖出 → 变现−$7,000亏损 → 预估节税额~$2,590
替代证券:RIVN.US / LCID.US / DRIV ETF(30天内避免回购TSLA)
⚠️ 若过去30天内购买过TSLA则存在洗售风险
2. XOM.US 卖出 → 变现−$1,200亏损 → 预估节税额~$240
替代证券:CVX.US或XLE ETF
[洗售规则警示]
- 检查近期购买日期;出售后30天内请勿回购。
- 购买已出售股票的看涨期权也可能触发洗售规则。
⚠️ 本分析仅供参考,不构成税务建议。请咨询持牌税务顾问。/ 本分析僅供參考,不構成稅務建議。請諮詢持牌稅務顧問。/ For reference only. Not tax advice. Consult a qualified tax professional.Error handling
错误处理
| Situation | 简体回复 | 繁體回復 | English reply |
|---|---|---|---|
| 回退到 MCP;若也不可用,请安装 longbridge-terminal | 回退到 MCP;若也不可用,請安裝 longbridge-terminal | Fall back to MCP; if unavailable, install longbridge-terminal. |
stderr | 请运行 | 請運行 | Run |
| No US positions | 账户中无美股持仓,税损收割仅适用于美股 | 賬戶中無美股持倉,稅損收割僅適用於美股 | No US positions found; tax-loss harvesting applies to US stocks only. |
| All positions profitable | 当前所有持仓均为浮盈,无税损收割机会 | 當前所有持倉均為浮盈,無稅損收割機會 | All positions are profitable; no harvesting opportunities. |
| Cost basis unavailable | 无法获取持仓成本,请检查账户权限 | 無法獲取持倉成本,請檢查賬戶權限 | Cannot retrieve cost basis; check account permissions. |
| 场景 | 简体回复 | 繁体回复 | English reply |
|---|---|---|---|
| 回退到MCP;若也不可用,请安装longbridge-terminal | 回退到MCP;若也不可用,請安裝longbridge-terminal | Fall back to MCP; if unavailable, install longbridge-terminal. |
stderr | 请运行 | 請運行 | Run |
| 无美股持仓 | 账户中无美股持仓,税损收割仅适用于美股 | 賬戶中無美股持倉,稅損收割僅適用於美股 | No US positions found; tax-loss harvesting applies to US stocks only. |
| 所有持仓均盈利 | 当前所有持仓均为浮盈,无税损收割机会 | 當前所有持倉均為浮盈,無稅損收割機會 | All positions are profitable; no harvesting opportunities. |
| 无法获取成本基准 | 无法获取持仓成本,请检查账户权限 | 無法獲取持倉成本,請檢查賬戶權限 | Cannot retrieve cost basis; check account permissions. |
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 - Account order history →
longbridge-orders - Dividend history →
longbridge-fundamental
- 投资组合健康检查 →
longbridge-portfolio-diagnosis - 账户订单历史 →
longbridge-orders - 股息历史 →
longbridge-fundamental
File layout
文件结构
longbridge-tax-harvesting/
└── SKILL.md # prompt-only, US accounts only, read-onlylongbridge-tax-harvesting/
└── SKILL.md # 仅基于提示词,仅适用于美国账户,仅可读