Realized PnL is calculated based on the opening price and the closing price after a position is closed.