Keep contribution and cash reserve separate

Current value is quantity multiplied by price for each holding. Add the new contribution, then subtract the cash set aside for costs to get the modeled holdings total. A reserve is cash retained outside those holdings, not a charged expense. Add cash as its own row at price $1 if cash is also a target asset.

Modeled holdings total = current portfolio + contribution − reserve
Target value = modeled holdings total × normalized target weight
Full-mode trade value = target value − current holding value

A hypothetical full rebalance

Suppose A is worth $800 and B $200, with a new $100 contribution and a $10 reserve. The modeled holdings total is $1,090. At 50/50 targets, each target value is $545. Full rebalancing sells $255 of A and buys $345 of B. Together, $255 of sales and $100 of new cash cover $345 of buys and the $10 reserve.

Contribution-only can leave drift

In the same example, contribution-only invests $90 into B and sells nothing. Final values are $800 and $290, with weights about 73.3945% and 26.6055%. The algorithm shares available new money in proportion to positive deficits against the final target. It does not promise to reach every target when the contribution is insufficient.

The rebalancing calculator keeps unrounded quantities for totals and CSV. Exchange lot sizes, actual fees, minimum orders and taxes require separate consideration. Displayed cents can differ slightly from unrounded totals. Use the depeg calculator to examine a separate stablecoin price scenario; it is not an allocation recommendation.