rebalance_portfolio
Generates buy and sell proposals to rebalance a portfolio toward target weights, deploying new cash to underweight assets first and selling only as a last resort while accounting for fees.
Instructions
Cash-flow-first rebalancer. New cash buys the most underweight buckets first (BUY orders only, via allocate_cash) -- CLAUDE.md's preferred order: use new cash, suspend buys on overweights, buy underweights, and sell only as a last resort. Set allow_sells=True to also see SELL orders for buckets still beyond the rebalance band after cash is deployed, listed separately under "sell_proposals"; the BUY-only orders key is unchanged either way. Nothing here executes a trade.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| targets | Yes | bucket/symbol -> target weight as a fraction of 1.0; values must sum to 1.0 | |
| cash_eur | No | ||
| allow_sells | No | Last resort per CLAUDE.md's rebalancing order: only when True are SELL orders for buckets past target+band also proposed, under 'sell_proposals'. BUY orders (from cash) are produced either way and are never affected by this. | |
| fixed_fee_eur | No | ||
| max_fee_ratio | No | ||
| current_values | Yes | bucket/symbol -> current absolute value in EUR | |
| variable_fee_pct | No | ||
| rebalance_band_abs | No |