computeGrossProfitOrLoss method

Decimal computeGrossProfitOrLoss(
  1. Decimal netBuyPrice,
  2. Decimal netSellPrice
)

Implementation

Decimal computeGrossProfitOrLoss(Decimal netBuyPrice, Decimal netSellPrice) {
  late Decimal dDelta;

  if (state.position! == MatexPosition.long) {
    dDelta = netSellPrice - netBuyPrice;
  } else {
    dDelta = netBuyPrice - netSellPrice;
  }

  return dDelta;
}