For Long positions :

Gross P&L = Quantity * (Avg Exit price - Avg Entry price)

Profit = Gross P&L - Total fee - Interest charged


For Short positions :

Gross P&L = Quantity * (Avg Entry price - Avg Exit price)

Profit = Gross P&L - Total fee - Interest charged