Profit & Loss Calculation, Average Open Price, and Break-Even Price

There are three metrics that are worth explaining in greater detail:

  • Profit & Loss (PnL): how much money you have made or lost on this product since you were last flat.
  • Average Open Price: Average price at which you bought since you were last flat.
  • Break-Even Price: the price at which you'd have to close your position to break even since you were last flat.

PnL

To calculate your PNL:

PnL: Position size * (Sell price - Buy price)
where position size is in number of coins.  So if you buy 5 BTC at $10,000 and sell 5 BTC for $11,000, you made 5 * (11,000 - 10,000) = $5000.
PnLSum(Current price - Fill price) * fill size  for all the fills since you were last flat.

Average Open Price

This is the weighted average of the price of your opening fills since you were last flat.

Opening Fills = All fills that were opened since you were last flat.

Opening Size = Sum(Fill Size) for all Opening Fills.

Average Open Price = Sum(Fill price * Fill Size) for all Opening Fills / Opening Size.

Break-Even Price

Opening Fills = All fills that were opening since you were last flat.

Opening Size = Sum(Fill Size) for all Opening Fills.

Opening Cost = Sum(Fill Price * Fill Size) for all Opening Fills.

Closing Fills = All fills that were closing since you were last flat.

Closing Size = Sum(Fill Size) for all Closing Fills.

Closing Proceeds = Sum(Fill Price * Fill Size) for all Closing Fills.

Break-Even Price = (Opening Cost - Closing Proceeds) / (Opening Size - Closing Size).

As an example, suppose you made the following trades:

  • BUY 11 BTC at $10,000
  • SELL 1 BTC at $12,000

Your sale was $2,000 higher than your buys, and so you can lose $200 selling each of 10 BTC you have open without losing money overall. This implies a break-even price of $9,800. Notice that the above formula gives the same number:

Opening Size = 11 BTC

Opening Cost = (11 BTC) * ($10,000 / BTC) = $110,000

Closing Size = 1 BTC

Closing Proceeds = (1 BTC) * ($12,000) = $12,000

Break-Even-Price = ($110,000 - $12,000) / (11 - 1) = $9,800