Friday, February 3, 2023

Realized profit calculation

This is, equation to find out how much money you made in  trading. useful with re-balance and grid
If you trade forex before and you jump to crypto, you gonna miss the realized profit.
the first I know if I wanna get my profit I must do a transaction history on my own,
for example, I bought at 10 and sell at 15, I got 5 as my realized profit, it work perfectly fine,
but I start have a problem when I have so many portfolio to handle.
So I need figure out this equation to help me solve the problem,
The concept is easy, it have two scenario if price higher than the start or the price lower than the start,
First we need to note our start assets and price when initial,


First price lower than the start.

Because grid or re-balance had significant to sell all the way before we hit the start price, and current price is lower how much many we actually had?

 The first we need to know what exposure we need to adjust at that price

for example I need to hold 1.9798 LTC when price at 99.500 LTC/USD

no matter how much I hold before I need to adjust to 1.9798 LTC,

and when to price starting go up to our started price (for example start price is 100 LTC/USD)

it gonna be like this.

Price           LTC hold
99.5000      1.9698
99.7500      1.9599
100.0000    1.9500

 So we need to sell all the way to  started price (100 LTC/USD)

Put all these factor to equation it gonna be like this 

(1.9798 come from exposure at price 99.2500 LTC/USD)

y =   (1.9798 - 1.9698) + (1.9698 - 1.9599) + (1.9599 - 1.9500)

y =  0.01 +  0.0099 + 0.0099

y = 0.0298


z = (0.01 * 99.5) + (0.0099 * 99.75) + (0.0099 * 100.00)

z = 0.995 + 0.987525 + 0.99

z = 2.9725


x = 2.9725 - 0.0298(99.500)

x = 0.0074


So our realized profit all time  of our portfolio at price 99.50 is 0.0074.


Second price higher than the start (it's gonna be easy )

x = ((current ltc hold)start price) + usd available - started asset

x = (1.9698)100.00 + 

x = 196.98 + your usd left - started asset


The second is so easy not like the first one because the first if price go lower we need to sell all the way, but if price higher than our start we can just calculate what is more than our started asset if we hold x(ltc) at start price + other assets .


No comments:

Post a Comment