About
Portfolio Rebalancer is a good-enough portfolio rebalancing calculator for the rest of us.
That is, us little passive investors who just want to know how to spread out our next investment amount across our chosen assets, or how to withdraw 4% max while affecting the portfolio’s target percentages as little as possible.
I whipped up this web app because spreadsheet formulas weren’t enough to satisfy how I wanted to balance whole number shares—I wanted an algorithm. And I wanted to be able to access this algorithm from my mobile phone while hiding in the bathroom, because my beloved toddler commandeers my laptop to use Paint whenever I open it.
In this app, you input your target allocations for each stock, and it tries to calculate the closest way to buy or sell shares in order to achieve target allocations.
It’s especially handy for those of us who buy whole shares, because when dealing with whole shares, we can’t always make values exactly match our targets. So, this app helps figure out the closest version to your target portfolio and the actions you should take to get there.
The rebalancing algorithm does this by using linear programming (a mathematical optimization technique). That is, the algorithm formulates a linear constraint optimization problem—it tries to get as close as possible to your target percentages while investing as much of your available cash as possible, and also adhering to other constraints (like ‘invest-only’ or ‘withdraw-only’ mode).
It’s also possible to ask the app to rebalance your portfolio by only selling and buying your existing holdings, with no extra cash available. If you do this, the app might calculate a solution with two or more phases—probably a selling phase, then a buying phase. That’s because by design, we will assume that we cannot instantaneously receive cash from sold shares—in real life, there’s often a delayed settlement time before we receive the cash from sold shares. Therefore, the algorithm only considers available cash on hand to be usable for buying shares in a single phase, not cash received from sold shares during that same phase.
Privacy: The app runs entirely in your browser—no portfolio data is collected. There’s a feature to save and load your portfolio data (because it’s annoying to have to enter it all over again)—it saves this data locally in your browser storage.
Usual disclaimer: Not financial advice. This app is an indi tool that was made to be a little better than my spreadsheet formulas, especially because of whole number shares. Professional rebalancing tools probably use more sophisticated methods like QP programming, but this is good enough for me—feel free to try it out and decide for yourself! Always check if the results make sense to you, because not all scenarios have been tested.
By the way, it’s possible for you to confuse the algorithm, for example by making impossible constraints. The algorithm will tell you if it’s determined or confused. If it gets confused, you could try increasing your available cash, adjusting target allocations, or setting buy-only or sell-only mode to simplify the puzzle. Or, perhaps it’s actually far from possible to achieve your target allocations, given available cash and market prices. Or, perhaps you found a bug.
Feel free to contact me at andy@portfolio-rebalancer.com to say hi or anything else!