This issue is brought to you by Tokenpad:
Tokenpad generates and earnings report for each asset you hold, across your crypto wallets.
The app is now live on the App store and Google Play store.
Advanced Concepts in Profit and Loss for Crypto Assets
In this article, we’re going deep on how to calculate your crypto earnings. In the first article, we touched on the base concepts and examples of profit and loss, cost basis, and tax lots.
Today, we’ll introduce the formulas that are needed to actually calculate these metrics
accurately. But first, we will start with the basics.
Why Track your Profits and Losses
All these numbers, why do you need them?
You can’t learn to invest better if you don’t know if you’re making money. Understanding PnL is crucial for investors to evaluate their strategies and make informed decisions. Maybe you’re making the same mistakes every time. Maybe you’re selling too early, or too late, or maybe your current portfolio is simply underperforming. You can’t know if you don’t track it.
Taxes. Most governments will have a tax on any realized profits you have over the year on your crypto, if you had any profit. You can use Tokenpad to help you understand this amount.
A Key Concept: Tax Lots
Let’s illustrate what a tax lot is using an example. Bob has bought ETH 4 different times:
Date | Amount (ETH) | ETH Price | Cost Basis |
1 Jan 2017 | 1 | $10 | $10 |
1 Jun 2017 | 2 | $280 | $560 |
3 Feb 2018 | 0.5 | $360 | $180 |
7 Oct 2021 | 1.5 | $4100 | $6150 |
Each of the times he has bought, a lot was created with different properties.
Lot Depletion: Selling or Transferring Out
If Bob decides to sell 2 ETH, which lots will be affected?
This is a hard question, as there are different ways of doing tax lot accounting:
FIFO: First in first out
LIFO: Last in first out
HIFO: Highest cost basis first
LOFO: Lowest cost basis first
Tax optimized: This selects the tax lots that minimize the capital gains
Let’s assume that today’s ETH price is $1500.
Date | Amount (ETH) | Price | Cost Basis | Net Worth @ $1,500/ETH | Gains/losses |
1 Jan 2017 | 1 | $10 | $10 | $1500 | +$1400 |
1 Jun 2017 | 2 | $280 | $560 | $3000 | +$2780 |
3 Feb 2018 | 0.5 | $360 | $180 | $750 | +$390 |
7 Oct 2021 | 1.5 | $4100 | $6150 | $2250 | -$3900 |
If we sum up all the cost basis, it would be $6900, if we sum up the amount it’s worth today, it would sum to $7500. This means that our unrealized profits (or losses) are +$600.
Upon closer look on a lot by lot basis, you can actually see that the first 3 lots were positive, but the last one had a big loss which offset some of the gains of the previous ones.
What happens if Bob decides to sell a total of 2 ETH? Which lots should be depleted?
This question relates to the tax advantage of each method. The important thing is that once a lot is crossed off and “depleted”, then it cannot be used for tax purposes next time around.
In Bob’s case, it would make most sense to do HIFO, which would mean that the highest average cost basis lot, which is the last lot, would get 100% depleted, and then the 3rd lot would also be 100% depleted. These are the lots with higher cost basis, and they sum exactly the 2 ETH that are being sold. In this case, because the two lots were sold, then profits or losses become realized.
Date | Amount (ETH) | Price | Cost Basis | Net Worth @ $1,500/ETH | Unrealized PnL | Realized PnL |
1 Jan 2017 | 1 | $10 | $10 | $1500 | +$1400 | $0 |
1 Jun 2017 | 2 | $280 | $560 | $3000 | +$2780 | $0 |
3 Feb 2018 | 0 | $360 | $180 | $750 | $0 | +$390 |
7 Oct 2021 | 0 | $4100 | $6150 | $2250 | $0 | -$3900 |
On lot 4, -$3900 in losses are realized, and on lot 3, +$390 gains are realized, for a net of -$3510 in realized losses. Think of it this way. These losses are locked in, no going back.
The rest of the lots (lot 1 and 2), which are totaling 3 ETH, have a total unrealized gain of +$4180.
If we take a look at the whole, the total profits/losses are the sum of the realized and unrealized PnL: $4180 - $3150 = $1030, still positive. But if the market goes down, then the unrealized and total profits might become losses.
This was an example for only ETH, Bob may have other assets in his portfolio, and the total profits or losses for a tax year might end up on the green or on the red. In most countries, a 15%-30% tax rate of profits only is paid to the government for capital gains. We will touch on taxes in the next article.
Total vs. Unrealized vs. Realized Profits and Losses
We’ll explain the nuances of the Profits and Losses (PnL) of a portfolio. PnL is also known as Earnings Report, or simply Gains and losses.
In short, a portfolio’s total PnL is the sum of both its realized PnL and its unrealized PnL.
The unrealized PnL is the current gain or loss only of the tokens that the users holds in their portfolio accounts.
The realized PnL is the past gain or loss that the user has generated by trading or transferring tokens at a past time.
We will introduce two methods for calculating a portfolio PnL, the tax lot method, which is the one the Tokenpad app uses, and the direct method.
Method 1: Tax Lots
We will dissect method 1 with the formulas used to calculate it. We will go over the formulas that make up the basic building blocks of a portfolio of assets: Lots, Tokens, and then the Portfolio. For both the total and the unrealized PnL.
Total PnL
The Total PnL is the sum of the realized and unrealized PnL.
Tax Lots
Every time you buy, you create a distinct lot, and each has different properties:
Date: The date the lot was created
Amount: The amount of tokens that the lot comprises
Avg cost basis: The avg. price of each unit of tokens, usually the price of the token at the time the transaction ocurred
Cost basis: The total costs that all the Amount of tokens comprise. The multiplication between Amount and Avg Cost Basis.
Depletion amount: The amount of tokens that have been depleted in that lot. A depletion happens when those tokens are transferred out, sold, or swapped. Put another way, this is the amount of tokens no longer in the user’s possesion
Avg. realized price: The weighted average (weight based on depletion amount) price at which the tokens were depleted.
Realized: The dollar equivalent that the depleted amount comprises. The multiplication between Depletion Amount and Average Realized Price.
As you can see, a lot is created by a single incoming transaction, but can be depleted through multiple outgoing transactions.
Token
With the basic 7 properties of each lot defined above, we can calculate the Token PnL through the following definitions:
Token Holdings: The total amount of tokens the user holds in that moment. In the formula below, l is the lot, and n is the last lot.
Token Total Average Cost Basis: The average cost basis of the acquired token across all lots
Token Total Cost Basis: The total cost basis
Token Avg. Realized price: The average realized price of the depletion amount
Token Total Realized: The total amount of dollars of what has been depleted
Token Total Dollar PnL: The amount of dollars that are profit or loss in that specific token
Token percentage PnL: The percentage of profit or loss relative to the invested cost basis
Portfolio
Now, we will calculate the portfolio total PnL.
Portfolio Net Worth: In this case, t is the array of Tokens in the user portfolio
Portfolio Total Cost Basis
Portfolio Total Realized
Total Dollar PnL
Total Percentage PnL
Unrealized PnL
Unrealized PnL only takes into account what is still being held. In this sense, definitions differ for the calculation of such.
Tax Lots
We start off with the same lot definitions, the one thing that changes is the definitions of Lot PnL.
Lot Holdings:
Lot Dollar PnL:
Lot Percentage PnL:
Token
Token Holdings Cost Basis: The total cost basis only of the holdings of the user:
Token Holdings Avg. Cost Basis: The average cost basis of each unit of the token being held
Token Unrealized PnL: The amount of dollars that are profit or loss in that specific token, only for the holdings the user is holding
Token percentage PnL: The percentage of profit or loss relative to the invested cost basis
Portfolio
Now, we will calculate the portfolio unrealized PnL.
Portfolio Holdings Cost Basis
Unrealized Dollar PnL
Total Percentage PnL
We only need to calculate the total and the realized PnL, and total minus realized will give us the unrealized PnL.
Method 2: Direct
This method for calculating the total PnL is more high level, and less specific, but should have the same result. Let’s break it down.
In this case:
Deposits: This is the amount of fiat used to buy crypto + the amount of incoming crypto within non-connected accounts at the time of the transaction
Proceeds: This is the dollar amount of crypto that has been sold for fiat + the amount of outgoing crypto within non-connected accounts at the time of the transaction
Using this same formula, we could also calculate the PnL for each token. Differently, this formula does not work for Lots.
We should compare both methods, and check that they should be equal.
How Tokenpad Calculates Your Profits and Losses Automatically
Unless you’re a fully fledged investment firm, you probably don’t have access to the tools and software needed to calculate it accurately and without headaches.
That’s why we’ve built Tokenpad, to help you track your profits and losses, and also discover new opportunities in the market. At our core, we want to help you become a smarter investor.
We run all the formulas so you don’t have to create complex spreadsheets
We have an automated transaction sync of Ethereum based chains up to 5k transactions
We allow for manual edits of transactions and cost basis
We allow for manual entry of buy and sell transactions on 50k+ tokens, if it’s in Coingecko, it’s in Tokenpad
You can download it now for free in the App Store.
Tokenpad uses the tax lots method, and FIFO for lot accounting, which is a standard practice.
We do have some caveats when it comes to connecting multiple wallets or accounts within Tokenpad and transacting between them.
Transacting within Connected Accounts
If Bob decides to partially or fully transfer a lot from one connected account to another, then the lot is subdivided into sublots. Sublots have the same properties and are linked to their parent lot, just that they are held on another of the user’s connected account.
It’s important to note that if a sell happens on an account, the only potential lots to select from should be rooted on that account. Meaning, I cannot sell and deplete the balance of one account, and decide that I’m selling the balance from a lot that is held on another account that had no depletion.
Transacting within Non-Connected Accounts
The case is different when Bob transfers with a non-connected account, in this case, we will assume that Bob is not the owner of the non-connected account, and we need to treat these transactions more as buys/sells:
If Bob transfers out to a non connected account, then we assume it’s a sell at the price of the asset at which the transaction occurs
If Bob receives a transfers in from a non connected account, then we assume it’s a buy at the price of the asset at which the transaction occurs
Up Next: Making Better Investment Decisions based on your profits and losses
Today, we took a detailed look at the formulas for calculating profits and losses when investing in crypto assets, breaking down each component to give you a clearer understanding of your portfolio’s performance. Grasping these concepts is crucial for every investor, as it forms the foundation for informed decision-making and strategic planning.
In the next article, we will help you take this knowledge further by analyzing your profit and loss reports to identify patterns and trends. We'll explore how to use this data to make smarter investment decisions, optimize your portfolio, and maximize returns. Understanding not only how to calculate PnL but also how to interpret it can significantly impact your investment strategy and overall success in the crypto market. Stay tuned as we guide you through leveraging your PnL insights to become a more confident and savvy investor.