Fyers Web - Realized and Unrealized Profit Calculations

Hey @communications_team @tejas_khoday ,

Can you please explain how do you calculate Realized and Unrealized profit? :expressionless:

This is how I calculated

Would be happy to learn your way of calculations :slight_smile:

**#FreshStart **

Thanks!

1 Like

@xO9f8VSHfY - Well, the underlying (for closed and open position) is the same. So, you cannot assume the first position is closed, it is actually still open because of the newly open trade. The Buy average and sell average gets calculated accordingly. Fyers team can explain this in detail if needed.

Realized profit = 150*((28+78.8)/2 - 84.5) = -4665

Unrealized profit = 150*(78.8 - (84.55+40.55)/2) = 2437.5

Hey @tdUAnV7K0d ,

There is no scope of assumption - Realized P&L is fixed and it doesn’t change.

What is subject to change is Unrealized P&L and Total P&L

This was a real intraday trade in the same script:

  • In the first trade, I booked loss and so it becomes a realized loss.
  • In the second trade, though 70% of loss is recovered unable to see the same in Unrealized P&L.
  • However, the Total P&L sum ups correctly.

Now, If I close the second trade and open a third trade -

  • First, latest Total P&L should be moved into Realized P&L
  • and then Unrealized and Total P&L should be recalculated

Will be happy to learn more from @communications_team !

Thanks!

What was the Avg Buy price when the 1st trade was closed and realized?

Why should the Avg Buy Price of a realized trade depend on the Buy Price of the unrealized trade?

@xO9f8VSHfY This is not how it works and I’ll let @communications_team team explain this further to you.