Given:
- a portfolio with only two assets (A and B)
- they respective balances (BalanceA and BalanceB)
the function $C_{AtoB}$ that converts A into B:
- $C_{AtoB}(x, q, cr) = x(1 - cr)q$, where
- x = the amount of Asset A to be convert
- q = the quotation of Asset A
- cr = the convertion rate cost
- $C_{AtoB}(x, q, cr) = x(1 - cr)q$, where
a target ratio between the values of Asset A and Asset B named $Tr$
- a scenario where:
$$ \frac{C_{AtoB}(Balance_A, q, cr)}{Balance_B + C_{AtoB}(Balance_A, q, cr)} > Tr$$
How to calculate the value X of asset A to be converted into asset B in order to the expression below become true?
$$ \frac{C_{AtoB}(Balance_A - X, q, cr)}{Balance_B + C_{AtoB}(Balance_A - X, q, cr)} = Tr$$
After solve the equation I found this:
$$X = \frac{Tr.Balance_B}{(1 - cr).q.(Tr - 1)} + Balance_A$$
But I am getting exactly the double of what I was expecting and I am not understanding why.
Ok, I got my error.
Instead of:
$$ \frac{C_{AtoB}(Balance_A - X, q, cr)}{Balance_B + C_{AtoB}(Balance_A - X, q, cr)} = Tr$$
I should have written:
$$ \frac{C_{AtoB}(Balance_A - X, q, cr)}{Balance_B + \color{red}{C_{AtoB}(X, q, cr)} + C_{AtoB}(Balance_A - X, q, cr)} = Tr$$
$\color{blue}{X}$ is the amount of asset A being converted into asset B so it will be part of the portfolio but as $\color{red}{C_{AtoB}(X, q, cr)}$ after the convertion.
Consequently, after solve it, instead of having:
$$X = \frac{Tr.Balance_B}{(1 - cr).q.(Tr - 1)} + Balance_A$$
I will get this:
$$X = \color{red}{\bigg[}\frac{Tr.Balance_B}{(1 - cr).q} + \color{red}{(Tr - 1).}Balance_A\color{red}{\bigg].-1}$$