Iteratively Rebalancing Portfolio Weights After Transaction Costs
Summary
The document considers moving a portfolio from current holdings to target weights when transaction fees are deducted from the traded assets and there is no separate cash balance. One proposed approach estimates post-fee portfolio value from initial allocations, calculates target dollar allocations, recomputes fees from the resulting trades, and repeats. An example reports that this iteration stabilizes within a few rounds, though the answer explicitly does not prove convergence in general.
A second response formulates the problem as minimizing squared deviations between achieved and desired weights, with each asset’s post-trade value adjusted for a fee proportional to the absolute trade. Its attempted derivative and closed-form reasoning are marked as erroneous or incomplete, and it notes that a self-financing constraint on net trades may matter. Thus, the iterative method is the more developed practical suggestion, while the optimization derivation should not be relied on as written. The example does not establish behavior across other portfolios or fee structures.
Key ideas
- Transaction fees reduce the portfolio value available for post-rebalance allocations.
- An iterative method can update estimated costs and target dollar allocations in succession.
- The example reports rapid numerical stabilization but provides no general convergence proof.
- A squared weight-error objective can express the goal of matching post-fee target weights.
- The derivative and matrix derivation in the document are acknowledged as flawed or incomplete.
- A self-financing constraint may be relevant when purchases must be funded by sales.
Tags
Full text
# Portfolio rebalancing to optimal weights including transaction costs and without cash component
# Portfolio rebalancing to optimal weights including transaction costs and without cash component
Consider a portfolio with 4 assets (A, B, C, D) with prices, quantities, current weights, and target weights as follows:
I want to rebalance the portfolio from the current weights to the target weights. There is a 0.2% transaction fee that is charged on the rebalance amount (i.e. the difference between the current and target weight) regardless of whether it is an increase or a decrease in that asset.
Assuming that the transaction fee is charged on the rebalanced amount of each asset, I would like to reach the target weights after taking into account the transaction fee. In other words, I want to achieve the Target Weight percentages after all fees have been paid from each asset.
While I know that funds usually have a cash component to cover these fees, I am interested in this scenario where there is no cash and the fee is deducted from each asset.
I am interested in calculating the amount to be rebalanced in each asset to achieve these target weights. What would be the general formula to do so?
## Answer by nbbo2 (score 2)
https://quant.stackexchange.com/a/60896
I do not think there is a closed form solution. I have applied a simple iterative method to your example problem. See below.
Let $N=4$ be the number of assets, indexed by $i$ ranging from 1 to $N$.
Let $x_i$ be the dollar allocations before rebalancing (in your example they are called "value (P*Q)").
Let $w_i$ be the desired post-rebalancing weights.
Let $\theta=0.002$ be the transactions cost per dollar transacted.
We want to find $y_i$, the dollar allocations after rebalancing.
The total transactions costs will be $T=\sum_i \theta |y_i-x_i|$
Unfortunately we cannot compute $T$ because it depends on the unknown $y_i$. If we had a good estimate of $T$ we could calculate the
Portfolio value after transaction costs $Y=\sum_i y_i=\sum_i x_i-T$
and then the dollar allocation after rebalancing $y_i=w_i Y$
The method I propose is: compute the allocation assuming no transactions cost, form an estimate of transaction costs, and find a refined allocation. From this allocation, find an improved estimate of transactions costs and so on.
Using you example, the convergence is very rapid, requiring just two or three iterations:
```
Estimated ReEstimt'd
0costAlloc TransCost ValAftCost NewAlloc TransCost ValAftCost NewAlloc
A 168000 64 167890.2 64.21952 167890.1654
B 113400 73.2 113325.9 73.34818 113325.8616
C 63000 46 62958.8 45.91768 62958.8120
D 75600 91.2 75550.6 91.10122 75550.5744
Tot. 420000 274.4 419725.6 419725.6 274.58659 419725.4134 419725.4134
```
If we start a third iteration the estimated transactions costs are 274.58671 which differs from the value above only in the 4th decimal place so I won't show the results here, the allocations are substantially the same.
I haven't proved that the results always converge. That's all I have for now.
## Answer by Attack68 (score 2)
https://quant.stackexchange.com/a/60899
Using some of @noob2 notation, if:
$x_i$: the initial dollar amount of asset i $t_i$: the transacted dollar amount of asset i $\theta$: the fee fraction (0.2%). $w_i$: the desired post balancing weights
Then you have the minimisation problem:
$$ \min_{t}{f(t)} = \sum_i \left ( \frac{x_i + t_i -\theta|t_i|}{\sum_j x_j +t_j -\theta|t_j|} - w_i\right )^2 $$
The minimum is zero (target weights achieved for each asset) and at this point we must have $\frac{\partial f}{\partial t_i} = 0$.
------- Contains errors: left for demonstration
$$ \frac{\partial f}{\partial t_i} = 2\frac{1-\theta sign(t_i)}{\sum_j x_j + t_j -\theta|t_j|} \left (1 - \frac{x_i + t_i -\theta |t_i|}{\sum_j x_j + t_j -\theta|t_j|} \right )$$
So multiplying through at with optimality conditions yields:
$$ x_i + t_i - \theta|t_i| = \sum_j x_j + t_j -\theta|t_j| \quad \forall i$$
Or in linear algebra notation, where $\mathbf{1}$ is a matrix of ones:
$$ \mathbf{(I - 1)}(\mathbf{t} - \theta |\mathbf{t}|) = (\mathbf{1-I}) \mathbf{x} $$
--------EDIT: Looking again, refreshed, the derivative above is wrong. The real derivative is more complicated. I leave this answer here if someone can complete but it might simply be too messy algebra to solve for a closed form optimisation solution in matrix notation
For
$X_i = x_i + t_i - \theta | t_i |$ (vector) $S = \sum_j x_j + t_j -\theta | t_j | $ (scalar)
Then:
$$ f(t) = \sum_i \left ( \frac{X_i}{S} - w_i \right )^2 $$
$$ \frac{\partial f}{\partial t_i} = 2 \left ( \frac{X_i}{S} - w_i \right ) \left( \frac{1 - \theta sign(t_i)}{S} \right ) + \sum_j 2 \left( \frac{X_j}{S} - w_j \right ) \left( \frac{-X_j (1-sign(t_i))}{S^2}\right )$$
When you set optimality condition and multiply through:
$$\left ( \frac{X_i}{S} - w_i \right ) + \sum_j \left( \frac{X_j}{S} - w_j \right ) \left( \frac{-X_j}{S}\right ) = 0$$ $$ \implies S X_i - S^2 w_i + \sum_j \left( X_j X_j - S w_j \right ) = 0 \quad \forall i$$
This looks suspiciously quadratic form-y and probably not going to yield a nice formula.
One other thing that I didn't include that might have improved matters is the constraint: $\sum_j t_j = 0$, ie. whatever you sell you buy in another asset. Would change the optimality conditions.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.