{"id":13558391,"url":"https://github.com/dashed/rebalance-app","last_synced_at":"2025-04-15T07:32:35.993Z","repository":{"id":49989062,"uuid":"93019649","full_name":"dashed/rebalance-app","owner":"dashed","description":"💸 Optimal lazy portfolio rebalancing calculator (in Rust)","archived":false,"fork":false,"pushed_at":"2023-08-29T06:00:18.000Z","size":251,"stargazers_count":52,"open_issues_count":10,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T17:57:26.677Z","etag":null,"topics":["funds","investing","money","passive-investing","portfolio","rebalance","rust","stocks"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dashed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-01T05:27:03.000Z","updated_at":"2025-03-12T19:28:12.000Z","dependencies_parsed_at":"2024-01-08T07:57:24.246Z","dependency_job_id":"5891b0d5-03ac-46c2-b38e-7b192ab85d64","html_url":"https://github.com/dashed/rebalance-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Frebalance-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Frebalance-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Frebalance-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Frebalance-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dashed","download_url":"https://codeload.github.com/dashed/rebalance-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249026957,"owners_count":21200534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["funds","investing","money","passive-investing","portfolio","rebalance","rust","stocks"],"created_at":"2024-08-01T12:04:55.609Z","updated_at":"2025-04-15T07:32:35.975Z","avatar_url":"https://github.com/dashed.png","language":"Rust","funding_links":[],"categories":["Rust","rust"],"sub_categories":[],"readme":"# rebalance-app\n\n[![Build Status](https://travis-ci.org/dashed/rebalance-app.svg?branch=master)](https://travis-ci.org/dashed/rebalance-app)\n\n\u003e Optimal lazy portfolio rebalancing calculator (in Rust)\n\n![](./screenshot.png)\n\n## Usage\n\n```\n$ rebalance-app --help\nrebalance-app 1.2.0\nAlberto Leal (github.com/dashed) \u003cmailforalberto@gmail.com\u003e\nOptimal lazy portfolio rebalancing calculator\n\nUSAGE:\n    rebalance-app [OPTIONS] \u003ccontribution\u003e --portfolio \u003cFILE\u003e --targets \u003cFILE\u003e\n\nFLAGS:\n    -h, --help       Prints help information\n    -V, --version    Prints version information\n\nOPTIONS:\n    -p, --portfolio \u003cFILE\u003e                 Sets a portfolio file\n    -i, --portfolio_value_index \u003cINDEX\u003e    Sets CSV index of the portfolio value\n    -t, --targets \u003cFILE\u003e                   Sets a targets file\n\nARGS:\n    \u003ccontribution\u003e    Sets the contribution amount\n```\n\n### Quickstart\n\n1. Set up `targets.csv`. Example: [example/targets.csv](example/targets.csv)\n\n2. Set up `portfolio.csv`. Usually you export this from your favourite broker. Example: [example/portfolio.csv](example/portfolio.csv)\n\n3. Run: `rebalance-app --portfolio example/portfolio.csv --targets example/targets.csv 5000`\n\nBy default, `rebalance-app` assumes the values of your assets in your portfolio CSV file is at the 2nd column (i.e. index 1). For example:\n\n```\nBond fund,                 roi %, ticker symbol, $16500.00\nTIPS fund,                 roi %, ticker symbol, $6500.00\nDomestic Stock ETF,        roi %, ticker symbol, $43500.00\nInternational Stock ETF,   roi %, ticker symbol, $33500.00\n```\n\nYou can adjust this using the `-i` flag:\n\n```\nrebalance-app -i 3 --portfolio example/portfolio.csv --targets example/targets.csv 5000\n```\n\n### About\n\n**Rationale:** Rather than rebalance your portfolio internally, add/remove money such that your asset targets % are achieved as close as possible.\n\nSee this article on rebalancing: https://www.bogleheads.org/wiki/Rebalancing\n\nBased on:\n\n- http://optimalrebalancing.tk\n- https://github.com/EDawg878/Portfolio-Rebalancer\n\n**How it works:**\n\nSource: [http://optimalrebalancing.tk/explanation.html (archived snapshot)](http://archive.today/IB0hQ)\n\n**Step 1: Calculate How Each Asset Deviates From Its Target**\n\n1. Define the difference between each asset's actual value and its intended portion after factoring in the new contribution. This difference is expressed as a percentage `f`, termed the fractional deviation.\n2. Compute `f` as: `f = a/t - 1`, where:\n   - `a` is the current value of the asset.\n   - `t` is the intended portion of the asset relative to the final total portfolio value, which is obtained by adding the new contribution to the original total portfolio value.\n\nA negative `f` indicates the asset is below its target, while a positive `f` means it's over its target.\n\n**Step 2: Distribute Funds to Assets to Equalize Their Deviations**\n\n1. Start by identifying the group of assets with the most negative (lowest) `f` values, i.e., those furthest below their target.\n2. Allocate a portion of the contribution to this group of assets. The goal is to bring their `f` values close to or equal to the next lowest `f` value among the remaining assets.\n3. Within this group of most underweight assets, distribute the contribution proportionally based on their target allocations. For instance, if two assets in this group have target allocations of 10% and 20% respectively, and you're adding $30, the first should get $10, and the second should get $20.\n\n4. Repeat steps 1 through 3 until all of the new contribution is distributed across the assets.\n\n# Chores\n\n- `cargo fmt`\n\n# License\n\nGPL-3.0+.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashed%2Frebalance-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdashed%2Frebalance-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashed%2Frebalance-app/lists"}