Formula to calculate trading quantity so that leaves half the profit in cash and half the profit in stock

30 Views Asked by At

Let's say I paid at \$80 10 units for \$800 + 1% of fees for the buying is a total of \$808 spent in 10 units.

Now, the price is \$85 and when I sell I will need to pay another 1% of fees but I want to distribute the profit into both cash and stock, so I'll end up with $\$800 + profit/2$ in cash and $profit/2*currentPrice$ in stock, not an integer.
Here the approximation I did:

$PV = PaidPrice * PaidUnits$
$CV = CurrentPrice * CurrentUnits$
$fee = 0.01$
$profit = CV(1-fee) - PV(1+fee)$

So I end up with this:
$PV + profit/2 = CV$
After working on the formula I end up like:
$PV(1+f) = CV(1-f)$

But that leaves all the profit in the stock, so I am trying to understand what am I doing wrong

1

There are 1 best solutions below

0
On BEST ANSWER

Try setting out all the values:

  • Initial unit price $P_i=80$
  • Current unit price $P_c=85$
  • Transaction fee rate $f = 0.01$
  • Initial number of units $U_i = 10$
  • Sale number of units $U_s$ (unknown as yet)
  • Final number of units $U_c$ (unknown as yet)
  • Final profit in cash $V_c$ (unknown as yet)

So we need three simultaneous equations to find the three unknowns

  • two ways of calculating the total profit: $V_c + U_cP_c = U_i (P_c - P_i) - f\, U_i P_i - f\, U_s P_c$
  • some of the initial units are sold and the rest kept: $U_i=U_s+U_c$
  • the cash profit has the same value as the share profit $V_c=U_cP_c$

Solving these will give

  • $U_c= U_i\dfrac{(1-f) P_c - (1+f)P_i}{(2-f)P_c} \approx 0.198049069$
  • $U_s =U_i-U_c \approx 9.801950931$
  • $V_c=U_cP_c\approx 16.83417085$

As a check

  • $10$ units were purchased at $\$80$ each for $\$800$ and a fee of $\$8$
  • $9.801950931$ units were sold at $\$85$ each for $\$833.1658291$ and a fee of $\$8.331658291$
  • so the cash surplus is $\$16.834170854$
  • and the remaining $0.198049069$ units valued at $\$85$ each are worth $\$16.834170854$