unrealizedPnL method
Calculates net unrealized profit or loss in absolute currency units.
Implementation
double unrealizedPnL(double currentPrice) {
if (isLong) {
return (currentPrice - entryPrice) * quantity;
} else {
return (entryPrice - currentPrice) * quantity;
}
}