Update: This feature is under beta testing and will be rolled out to all users gradually.
- Average Buy Price (ABP)
- Invested value
- Unrealized P&L (Profit & Loss)
- Realized P&L
- Impact of events other than trades
- Average Buy Price
The most important component of the P&L (Profit & Loss) feature and the related metrics is the Average Buy Price (ABP). Calculating the ABP is very simple if one has never sold the asset (coin/token). Still, as soon as there are sell transactions for the asset, there are multiple possible approaches to calculate the updated ABP of the remaining asset balance.
The approach we have taken to calculate the ABP is based on FIFO (First In First Out) methodology, which is also commonly used for tax reporting purposes. Let's try to understand this with the help of an example:
Let's calculate the ABP (Average Buy Price) after each transaction-
Transaction 1: You just bought your first 5 BTC coins at the rate of 100 per token, the ABP (Average Buy Price) will also be 100
Transaction 2: You bought 10 more tokens at the rate of 150 per token, by calculating the weighted average, the ABP will become (5*100 + 10*150)/(5+10) = 133.3
Transaction 3: When you sell 3 BTC coins, the FIFO approach requires us to assume that the coins bought first are also sold first, i.e although you have 15 BTC coins in your account, we’ll assume that the 3 coins sold were from the first batch of 5 coins bought at the price of 100
Hence, after this transaction, you are left with 5-3 = 2 coins from the first transaction bought at the rate of 100 per coin and all 10 coins from the 2nd transaction bought at the rate of 150 per coin. Therefore, the new ABP of the remaining 12 coins in your account would be
(2*100 + 10*150) / (2+10) = 141.6.
Transaction 4: Now, when you sell 5 more BTC coins, using the same approach as above, we’ll assume that the 2 remaining coins from 1st purchase would be sold first, followed by 3 coins from the second purchase.
Hence, you would have sold all the coins from your first purchased batch of 5 coins and 3 from the second batch after this transaction. Now, you would be left with 7 coins, all from the 2nd batch of coins purchased at the rate of 150 per coin; hence the average buying price of the remaining 7 coins would be 150. To get the same result from the formula, we have been using
(0*100 + 7*150) /(0+7) = 7*150/7 = 150
Now that we have understood how ABP (Average Buy Price) is calculated. Let's see how it is used to calculate multiple P&L-related metrics.
- Invested Value
For any coin, the invested value is the product of ABP and the current balance of the coins. In the above example, after the 4th transaction, the invested value can be calculated as follows-
Average Buy Price = 150
Coin balance = 7.
Hence, Invested value = 150*7 = 1050.
The sum of the invested value of all your coins becomes the investment value for your total portfolio.
- Unrealized P&L (or All time Gains)
The unrealized P&L, commonly referred to as just P&L or Gains, is the difference between the invested value and the current value of that coin. In the above example, after the 4th transaction, say on 26/5/2021, if the market price of the coin is 180, The P&L can be calculated as follows-
Invested value (ABP*balance) = 150*7 = 1050
Current market price = 180
Current value = 180 *7 = 1260
P&L (All time Gains) = Current value - invested value = 1260- 1050 = 210
The sum of All Time Gains of all the coins gives us the Gains at the portfolio level.
P&L as percentage: There are two ways to look at percentage gains for your portfolio. It is the percentage difference between the invested value and the current value of the coin or, alternatively, the difference between the ABP and the coin's current price. For the above example, we are calculating the percentage using the investment and current value:
Invested value = 1050
Current value = 1260
P&L % = (1260-1050)/1050 *100% = 210/1050*100% = 20%
A positive value of the P&L% means that the coin or portfolio is in profit, while negative % value means it is in loss.
- Realized P&L
The Unrealised P&L and percentage change we have explained above is what you would commonly see in most portfolios across investment apps. Wherever you find just P&L or Gains, it's usually referring to ‘Unrealised’ P&L or Gains. i.e., the current state of Profit or Loss on the asset you still hold in your portfolio. The other counterpart here is ‘Realized P&L’ or ‘Realized Gains,’. This is the Profit or Loss made on the tokens you have already sold. While these are currently not displayed in Phase-1 of WazirX’s portfolio tracker, we are working on adding it in future.
Realized P&L can be calculated using the difference between the Avg Buy Price of the asset sold and its selling price. Using the sample transactions shown above. let's calculate the realized gains for the second Sell transaction (Trnx #4),
As explained in section 2 above, while using the FIFO approach, we assume that the 5 coins sold in this sell order consist of 2 coins from the first purchase batch and 3 from the second batch.
Hence, their avg buy price would be = (2*100 + 3*150)/5 = 130
Total buy value = 130*5 = 650
The sell price = 120
Total sell value = 120*5 = 600
Therefore total Realized P/L = 600- 650 = -50 (negative represents loss)
The percentage Realized P&L can be calculated as the % difference between selling and avg buy value
P&L % = (sell value- buy value)/sell value * 100
= (600-650)/600*100% = -50/600*100% = -8.3%
- Impact of events other than trades
Coin balance in your WazirX wallet can increase or decrease due to factors other than buy/sell transactions. Some common cases could be Referral rewards, Airdrops, and direct crypto deposits or withdrawals to other crypto wallets. For the P&L calculation to be accurate, all such cases must be handled carefully by attributing an appropriate buy or sell price. Following are some of the common events which lead to the addition or removal of coin balance from the WazirX wallet and how the buy and sell price are attributed to them for P&L calculation on the WazirX App.
Please reach out to the support team via support.wazirx.com for any other questions on the P&L calculation approach.