Skip to content

feat: add portfolio-rebalancer skill for target allocation rebalancing#9

Merged
ianalloway merged 1 commit intodevin/1771094911-openclaw-skillsfrom
devin/1771290734-add-portfolio-rebalancer-skill
Feb 17, 2026
Merged

feat: add portfolio-rebalancer skill for target allocation rebalancing#9
ianalloway merged 1 commit intodevin/1771094911-openclaw-skillsfrom
devin/1771290734-add-portfolio-rebalancer-skill

Conversation

@ianalloway
Copy link
Owner

feat: add portfolio-rebalancer skill

Summary

Adds a new portfolio-rebalancer OpenClaw skill that calculates trades needed to rebalance a portfolio to target allocations. The skill is a single SKILL.md file with embedded python3 -c snippets covering:

  • Simple rebalance — compute buy/sell trades to hit target percentages
  • Rebalance with deposit — factor in new cash when rebalancing
  • Drift detection — check if any asset has drifted beyond a configurable threshold
  • Tax-aware (buy-only) rebalancing — only buy underweight assets, never sell

Supports stocks, crypto, ETFs, and mixed portfolios. Follows the same frontmatter/metadata format as the existing skills (e.g., kelly-criterion).

Review & Testing Checklist for Human

  • Run every python3 -c snippet in a terminal — the escaped f-strings inside double-quoted bash strings (\"\") are fragile and may fail on copy-paste. This is the biggest risk in the PR.
  • Verify math correctness — run the example portfolios through the rebalance functions and sanity-check that BUY/SELL directions and quantities make sense (e.g., the crypto example with BTC/ETH/SOL).
  • Confirm targets don't-sum-to-1.0 behavior — the code documents targets "must sum to 1.0" but never validates it. Decide if a guard clause is needed or if silent garbage output is acceptable.

Notes

  • No existing code is modified; this is purely additive (new directory + file).
  • The skill only requires python3 (no pip packages), consistent with the repo's other skills.
  • The buy_only_rebalance function silently drops fractional-cent remainder cash — probably fine in practice but worth knowing.

Link to Devin run: https://app.devin.ai/sessions/86b10eb8263049ef8e1b94ef22521f81
Requested by: @ianalloway

New skill that calculates exact trades needed to rebalance portfolios:
- Simple rebalance to target allocations
- Rebalance with new cash deposits
- Drift detection with configurable thresholds
- Tax-aware buy-only rebalancing
- Supports stocks, crypto, ETFs, and mixed portfolios

Co-Authored-By: Ian Alloway <adapter_burners.1y@icloud.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@ianalloway ianalloway merged commit 17a1133 into devin/1771094911-openclaw-skills Feb 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant