Token导航 LogoToken导航

Agent Skill · 待分类

rebalancing(rebalancing 命令行)

rebalancing 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

rebalancing 是待分类类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描有提醒项,按安装量在待分类类的 11,209 个 Skill 里排第 2,264。

总安装 1,723周安装 74GitHub Stars 58下载 604核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:rebalancing(rebalancing 命令行)
来源仓库:https://github.com/joellewis/finance_skills
仓库路径:skills/rebalancing
安装命令:
npx skills add https://github.com/joellewis/finance_skills --skill rebalancing
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/joellewis/finance_skills --skill rebalancing

这个 Skill 是做什么的

这个 Skill 的分类还没最终确定,用法以来源仓库的说明为准。

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中整理仓库状态或协作事项。支持围绕代码变更、分支合并或项目进度进行信息组织与协调。通过 npx skills add 命令从指定 GitHub 仓库安装使用。

安装前需确认权限范围、维护状态及是否涉及命令执行或文件读写。rebalancing 属于待分类类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/rebalancing

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/joellewis/finance_skills --skill rebalancing;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

rebalancing 怎么安装?

在终端执行 npx skills add https://github.com/joellewis/finance_skills --skill rebalancing。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

rebalancing 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

rebalancing 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

rebalancing 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

rebalancing 用的人多吗?

公开数据是累计安装 1,723 次,近一周安装 74 次,下载 604 次,GitHub 58 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

rebalancing 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理待分类类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

待分类类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
infsh-cli

infsh CLI · Codex、Claude

4,374,576382权限未标注未明确未收录
ai-video-generation

AI 视频生成 · Codex、Claude

4,313,376382调用外部服务未明确有提醒
lark-openapi-explorer

云雀 OpenAPI 浏览器 · Codex、Claude

2,064,1209,011需要联网未明确有提醒
lark-workflow-standup-report

Lark 工作流程站立报告 · Codex、Claude

2,041,6328,978需要联网未明确通过
use-my-browser

使用我的浏览器 · Codex、Claude

1,848,49140操作浏览器未明确未通过
rebalancing

rebalancing 命令行 · 本页

1,72358需要联网未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Rebalancing

Purpose

Provides frameworks for maintaining portfolio allocations over time as market movements cause weights to drift from targets. Covers calendar and threshold rebalancing strategies, optimal band widths, transaction cost considerations, tax-efficient approaches including tax-loss harvesting, and practical implementation across account types.

Layer

4 — Portfolio Construction

Direction

both

When to Use

  • Deciding when and how to rebalance a portfolio back to target weights
  • Comparing calendar-based vs. threshold-based rebalancing strategies
  • Setting optimal rebalancing bands that balance tracking error against transaction costs
  • Implementing tax-efficient rebalancing and tax-loss harvesting
  • Managing rebalancing across taxable and tax-deferred accounts
  • Using cash flows (contributions/withdrawals) to rebalance opportunistically
  • Evaluating the rebalancing premium and its contribution to portfolio returns

Core Concepts

Calendar Rebalancing

Rebalance at fixed time intervals regardless of drift magnitude:

  • Monthly: Tightest tracking to targets; highest transaction costs
  • Quarterly: Common institutional frequency; good balance of tracking and costs
  • Annually: Lowest cost; may allow significant drift between dates

Calendar rebalancing is simple to implement and schedule but may miss large dislocations between dates or trigger unnecessary trades when drift is minimal.

Threshold (Band) Rebalancing

Rebalance when any asset weight drifts beyond a defined tolerance band around its target:

  • Monitor weights continuously (or at regular intervals)
  • Trigger rebalancing when |w_actual - w_target| > tolerance
  • Typical bands: +/- 3% to +/- 5% (absolute) or +/- 20% to +/- 25% (relative)

Threshold rebalancing is more responsive to market dislocations and avoids unnecessary trades when markets are calm. However, it requires more frequent monitoring.

Optimal Band Width (Leland Model)

Leland (2000) derived the optimal no-trade band width as a function of transaction costs, risk aversion, and asset variance:

Band width proportional to (3 * transaction_cost / (2 * risk_aversion * variance))^(1/3)

Key intuition:

  • Higher transaction costs → wider bands (trade less)
  • Higher risk aversion → narrower bands (maintain target more tightly)
  • Higher variance → narrower bands (drift happens faster, risk of deviation is greater)

Rebalancing Premium

Systematic rebalancing generates a "volatility harvesting" or "rebalancing premium" through the buy-low/sell-high mechanism:

  • When an asset rises, its weight increases → rebalancing sells some (sell high)
  • When an asset falls, its weight decreases → rebalancing buys some (buy low)

This effect is sometimes called Shannon's Demon: in a two-asset portfolio with equal expected returns but independent volatility, the constantly rebalanced portfolio outperforms buy-and-hold. The rebalancing premium is larger when:

  • Asset volatilities are higher
  • Correlations are lower
  • Assets have similar expected returns (so mean-reversion dominates trends)

Note: The rebalancing premium is not a free lunch — it underperforms in trending markets where winners keep winning.

Transaction Costs

Costs incurred when rebalancing that reduce net returns:

  • Commissions: Per-trade or per-share fees (increasingly zero for retail)
  • Bid-ask spread: The cost of crossing the spread; wider for less liquid assets
  • Market impact: Price movement caused by the trade itself; significant for large positions in less liquid markets
  • Opportunity cost: Delay cost if rebalancing is deferred to avoid transaction costs

Total implementation cost = commissions + half-spread + market impact + opportunity cost

Tax-Efficient Rebalancing

Strategies to minimize tax impact when rebalancing in taxable accounts:

  1. Use cash flows: Direct new contributions to underweight assets and withdrawals from overweight assets
  2. Redirect dividends and interest: Reinvest income from overweight assets into underweight assets
  3. Rebalance with new contributions: The most tax-efficient method — no selling required
  4. Asset location: Hold tax-inefficient assets (bonds, REITs) in tax-deferred accounts; rebalance these freely
  5. Selective lot identification: When selling, choose tax lots with the highest cost basis (lowest gain) or lots held over one year (long-term capital gains rate)

Tax-Loss Harvesting (TLH)

Proactively selling losing positions to realize capital losses that offset capital gains:

Tax benefit = Realized loss * Marginal tax rate

Rules and implementation:

  • Wash sale rule: Cannot repurchase a "substantially identical" security within 30 days before or after the sale (61-day window total)
  • Replacement security: Substitute a similar but not identical asset to maintain market exposure (e.g., sell one S&P 500 ETF, buy a total market ETF)
  • Timing: Most opportunities arise during market drawdowns
  • Long-term benefit: Harvested losses can offset current gains, and unused losses carry forward indefinitely. Up to $3,000 of net losses can offset ordinary income per year.

Rebalancing Across Account Types

When an investor has multiple account types (taxable, IRA, 401k), optimize rebalancing by:

  • Tax-deferred accounts (IRA, 401k): Rebalance freely — no tax consequences
  • Taxable accounts: Minimize selling; use cash flows, TLH, and selective lot sales
  • Cross-account rebalancing: Consider the aggregate portfolio across all accounts and rebalance within the most tax-efficient account

Drift Tolerance Setting

Factors that determine optimal band width:

  • Tighter bands (e.g., +/- 2%): Better risk control, higher costs, appropriate for low-cost/institutional settings
  • Wider bands (e.g., +/- 10%): Lower costs, more drift risk, appropriate for taxable accounts with high tax impact
  • Asset-specific bands: More volatile assets may need wider absolute bands but tighter relative bands

Cash Flow Rebalancing

Use regular deposits or withdrawals to move toward target weights without explicit rebalancing trades:

  • Calculate current vs. target weights
  • Direct 100% of new contributions to the most underweight asset(s)
  • Process withdrawals from the most overweight asset(s)
  • This "natural rebalancing" is the most cost-effective and tax-efficient approach

Rebalancing Workflow

The concepts above describe the *what* and *why* of rebalancing. This section covers the operational *how* — the step-by-step process an advisor follows to execute a rebalance for a client household.

Step 1: Aggregate Household View Assemble the complete picture across all accounts (taxable brokerage, Traditional IRA, Roth IRA, 401(k), 529, trust). Calculate the household-level allocation by summing positions across all accounts, not just individual account allocations. Many drift problems are invisible at the account level but obvious at the household level.

Step 2: Asset Location Review Before proposing trades, document which account types hold which asset classes:

  • Tax-inefficient assets (bonds, REITs, high-turnover funds) should be in tax-deferred accounts
  • Tax-efficient assets (index equity ETFs, municipal bonds) should be in taxable accounts
  • Highest-growth assets should be in Roth accounts (permanent tax-free growth)

If asset location is suboptimal, the rebalance is an opportunity to improve it — but only if the tax cost of repositioning is justified by the long-term tax savings.

Step 3: Drift Analysis and Trade Generation For each asset class, calculate drift from target and compare against tolerance bands (from the IPS or firm default):

  • Generate a preliminary trade list: sell overweight positions, buy underweight positions
  • Prioritize trades by drift magnitude — address the largest deviations first
  • Check whether cash flows (pending contributions, withdrawals, dividends) can partially or fully close the drift without explicit trades

Step 4: Tax-Impact Estimation For each proposed sell trade in a taxable account, estimate the tax consequence:

  • Identify available tax lots and their holding periods (short-term vs long-term)
  • Calculate the estimated capital gain or loss for each lot using specific identification (HIFO preferred)
  • Sum the estimated tax liability across all proposed sells
  • Compare the tax cost against the risk-reduction benefit of rebalancing — defer trades where tax cost outweighs the tracking error reduction
  • Coordinate with any pending tax-loss harvesting opportunities (see tax-loss-harvesting skill)

Step 5: Cross-Account Optimization Minimize total household tax impact by choosing *where* to execute each trade:

  • Execute sells of appreciated positions in tax-deferred accounts when possible (no tax consequence)
  • Execute sells of depreciated positions in taxable accounts (harvest the loss)
  • Use cross-account rebalancing: if equities are overweight in the taxable account and underweight in the IRA, sell equities in the IRA and buy bonds in the IRA, rather than selling equities in the taxable account
  • Check for wash-sale conflicts: if harvesting a loss in the taxable account, ensure no purchase of a substantially identical security occurs within 30 days in any account (including IRA, 401(k), and spouse accounts)

Step 6: Before/After Comparison Generate a before/after allocation comparison for advisor review and client communication:

  • Current allocation vs target allocation vs post-rebalance allocation (three columns)
  • Estimated transaction costs (commissions, spreads)
  • Estimated tax impact (net gains/losses realized)
  • Expected tracking error reduction
  • Number of trades and accounts affected

This comparison serves as both a decision tool (does the rebalance justify its costs?) and a compliance artifact (documenting the rationale for the trades).

Step 7: Execution and Confirmation

  • Submit the approved trade list through the order management system
  • For block trades across multiple accounts, ensure fair allocation per the firm's allocation policy
  • Confirm fills and reconcile actual vs intended post-rebalance weights
  • Document the rebalance event: date, reason (scheduled, threshold trigger, or ad-hoc), trades executed, and resulting allocation

Key Formulas

FormulaExpressionUse Case
Threshold Triggerw_actual - w_target
Optimal Band Widthband ~ (3*tc / (2*lambda*sigma^2))^(1/3)Leland optimal no-trade zone
Tax-Loss BenefitBenefit = Loss * Tax RateValue of harvested losses
Transaction CostTC = commission + spread/2 + impactTotal rebalancing cost
DriftDrift_i = w_actual_i - w_target_iWeight deviation from target
Trade SizeTrade_i = (w_target_i - w_actual_i) * Portfolio ValueDollar amount to trade
Rebalancing PremiumRP ~ (1/2) * Σ w_i * sigma_i^2 - (1/2) * sigma_p^2Volatility harvesting estimate

Worked Examples

Example 1: Threshold Rebalancing — 60/40 Portfolio

Given:

  • Target: 60% equity / 40% bonds
  • Rebalancing threshold: +/- 5% (absolute)
  • Current portfolio value: $1,000,000
  • After market movement: equity = $680,000 (68%), bonds = $320,000 (32%)

Calculate: Rebalancing trigger and required trades

Solution:

Check drift:

  • Equity drift: 68% - 60% = +8% → exceeds +5% threshold → TRIGGER
  • Bond drift: 32% - 40% = -8% → exceeds -5% threshold → TRIGGER

Target dollar amounts:

  • Equity target: 60% * $1,000,000 = $600,000
  • Bond target: 40% * $1,000,000 = $400,000

Required trades:

  • Sell equity: $680,000 - $600,000 = $80,000
  • Buy bonds: $400,000 - $320,000 = $80,000

Proceeds from equity sales fund the bond purchases. In a taxable account, check the cost basis of equity lots being sold to estimate tax impact before executing.

Example 2: Tax-Loss Harvesting Benefit

Given:

  • Position purchased for $50,000, current value $40,000
  • Unrealized loss: $10,000
  • Investor's marginal federal tax rate: 37% (ordinary income) / 20% (long-term capital gains)
  • Investor has $15,000 in realized capital gains this year

Calculate: Tax benefit of harvesting the loss

Solution:

Realized loss from sale: $10,000

Tax benefit calculation:

  • The $10,000 loss offsets $10,000 of the $15,000 in realized capital gains
  • Tax saved: $10,000 * 20% = $2,000 (assuming long-term gains rate)
  • Remaining gains: $15,000 - $10,000 = $5,000 (still taxable)

If the investor had no capital gains to offset:

  • First $3,000 offsets ordinary income: $3,000 * 37% = $1,110
  • Remaining $7,000 carries forward to future years
  • Total immediate benefit: $1,110; total eventual benefit up to $2,000+ depending on future gains

Implementation:

  1. Sell the losing position for $40,000
  2. Immediately purchase a similar but not substantially identical replacement (e.g., swap a total US stock ETF for an S&P 500 ETF)
  3. Do NOT repurchase the original security within 30 days (wash sale rule)
  4. After 31 days, may swap back to original security if preferred

Note: TLH creates a lower cost basis in the replacement security, so taxes are deferred, not eliminated. However, the time value of the tax deferral and the ability to offset gains at favorable rates makes TLH valuable.

Common Pitfalls

  • Over-rebalancing: trading too frequently erodes returns through transaction costs and taxes, especially in taxable accounts
  • Under-rebalancing: allowing excessive drift exposes the portfolio to unintended risk levels and style drift
  • Wash sale violations when tax-loss harvesting: purchasing a substantially identical security within the 61-day window triggers wash sale rules, disallowing the loss
  • Ignoring tax impact of rebalancing in taxable accounts: rebalancing by selling winners generates taxable capital gains
  • Calendar rebalancing may miss large dislocations between dates (e.g., a 20% market crash between quarterly rebalancing dates)
  • Not accounting for the rebalancing premium when comparing strategies — buy-and-hold backtests may understate rebalanced portfolio returns
  • Forgetting to consider the full 61-day wash sale window (30 days before and after the sale)
  • Rebalancing into the wrong account: selling appreciated assets in taxable accounts when the same rebalancing could be done in tax-deferred accounts

Cross-References

  • asset-allocation (wealth-management plugin, Layer 4): rebalancing maintains the target asset allocation over time
  • diversification (wealth-management plugin, Layer 4): rebalancing preserves the intended diversification structure
  • bet-sizing (wealth-management plugin, Layer 4): position sizes drift and need rebalancing to maintain conviction weighting
  • historical-risk (wealth-management plugin, Layer 1a): drift changes portfolio risk profile; rebalancing controls it
  • financial-statements (wealth-management plugin, Layer 2): tax implications of rebalancing require understanding of tax accounting
  • tax-loss-harvesting (wealth-management plugin, Layer 5): TLH trades should be coordinated with rebalancing to minimize total transaction count and avoid wash-sale conflicts
  • tax-efficiency (wealth-management plugin, Layer 5): asset location and tax-lot selection strategies directly affect rebalancing trade decisions
  • client-review-prep (advisory-practice plugin, Layer 10): drift analysis and rebalancing recommendations are core agenda items in periodic client reviews

Reference Implementation

See scripts/rebalancing.py for computational helpers.

平台分布

Codex

38.62%
按下载量换算233

Claude

27.87%
按下载量换算168

Cursor

20.65%
按下载量换算125

Gemini CLI

9.97%
按下载量换算60

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills