Profit & Loss

Warning

THESE TOOLS ARE ONLY USEFUL FOR ESTIMATING PROFIT AND LOSS.

We introduce profit_loss_amount to indicate an artificial “cost” for each trade (fill). This field is computed for each trade (fill).

The sum of these fields will be an estimate for the realized P&L ONLY for flat (zero) positions.

For open (non-zero) positions, we can’t split between realized and unrealized P&L. This will require an accounting method and potentially the history of transactions, e.g. when using the FIFO method.

The calculation follows

profit_loss_amount = -1 * side * price * multiplier * (quantity + accrued_interest)