A CLI tool for contribution-only portfolio rebalancing.
Project description
Portfolio Rebalancer
A CLI tool designed to help investors maintain their target asset allocation through contribution-only rebalancing.
This project was built using Gemini CLI to explore AI-driven development for architectural designs, scaffolding, and code generation.
Motivation
I originally managed my investments and rebalancing through a spreadsheet. I ported the logic to a CLI tool to achieve:
- Workflow efficiency. Faster execution and a foundation for future automation.
- Version control. My investment strategy and portfolio can now be tracked with Git.
- Reliability. All logic lies within modules that are invisible to the user. No more accidental formula breaks!
Features
- Tax-Efficient Logic: Prioritizes buying underweight assets, never selling.
- JSON Portfolios: Load your custom portfolio from a simple
jsonfile. - Proportional Scaling: Handles contributions that are too small to fill all gaps perfectly.
- Modern Python: Built with type hints, dataclasses, and a modular package structure.
Installation
Install the tool directly from PyPI:
pip install portfolio-rebalancer-cli
Usage
-
Configure your portfolio: Create a
portfolio.jsonfile in your current directory using the following format, adding asset classes and adjusting according to your portfolio:{ "assets": [ { "name": "US Total Stock", "target_allocation": 0.60, "current_balance": 6000.00 }, { "name": "International Stock", "target_allocation": 0.30, "current_balance": 2000.00 }, { "name": "Bond Market", "target_allocation": 0.10, "current_balance": 2000.00 } ] }
-
Run the rebalancer:
-
Default Mode (looks for
portfolio.jsonin current folder):rebalance --contribution 1000
-
Custom File Mode:
rebalance --contribution 1000 --file my_custom_portfolio.json
-
Development & Testing
If you want to contribute or run the tests:
git clone https://github.com/aaronCruise/Portfolio-Rebalancer.git
cd Portfolio-Rebalancer
pip install -e .
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file portfolio_rebalancer_cli-0.2.0.tar.gz.
File metadata
- Download URL: portfolio_rebalancer_cli-0.2.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a0b7fa2e5d2e2f24c1cd74f1adb158b8efe55c3a02545f36fdee51de1a87f17
|
|
| MD5 |
f5355b6bc0b802530f5e417c70c84a49
|
|
| BLAKE2b-256 |
b6f1267cb3c3519ae247a351168c99b7421b92e64c729b8b8e9150620cfb9a9b
|
File details
Details for the file portfolio_rebalancer_cli-0.2.0-py3-none-any.whl.
File metadata
- Download URL: portfolio_rebalancer_cli-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27ed8b1d0a4c9f6ae9a7c64dea7039b7ffdcfeca3611294a37c7bcf6ab6e9ab1
|
|
| MD5 |
ee40aaf39f185f804ec299a7e8da82b4
|
|
| BLAKE2b-256 |
0f3f95f2f8cc31ce56a9f56f0b27f5f6e726d4600c2bbb6a49661f5df901d0c1
|