Skip to main content

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.

output_example

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 json file.
  • 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

  1. Configure your portfolio: Create a portfolio.json file 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
        }
      ]
    }
    
  2. Run the rebalancer:

    • Default Mode (looks for portfolio.json in 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

portfolio_rebalancer_cli-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

portfolio_rebalancer_cli-0.1.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file portfolio_rebalancer_cli-0.1.0.tar.gz.

File metadata

File hashes

Hashes for portfolio_rebalancer_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 00e26efef513867b799ff4e22607aa77f56c7cf21df82e5cdbadd74bc8f0ec5f
MD5 990d11029b2a43c7481820517a247bd4
BLAKE2b-256 da1783de1664ffae7dbcb0397e7635636ddea5cd1d13a40aaa92b0f5103e19cd

See more details on using hashes here.

File details

Details for the file portfolio_rebalancer_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for portfolio_rebalancer_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e8c8f969af71243f3466cfbbff3cefee2908d79f41b2c4a94b381593c28970b
MD5 e1f6c0fca20d33c7658671df73fd3965
BLAKE2b-256 4889612e2d1048ad99305b512af43e0f7e1d096978ffc4c1d2f1378618a95f12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page