I read a lot of places where it takes the following steps to calculate unrealized gain/losses:

step1: Multiply the price you paid per share by the number of shares purchased to calculate your cost for the stock.

step2: Multiply the current price by the number of shares you own to figure the current value of the stock.

step3: Subtract your cost from the current value to figure your unrealized gain.

However, what if you sold some crypto, then how would you deduct that sold amount into the unrealized gain/loss equation? Below is my example, for simplicity, not going to include fees:

date trade amount settled_price balance
1/1 buy 1 40k 1
1/2 buy 1 41k 2
1/3 sell 0.5 42k 1.5
1/4 buy 1 43k 2.5

so, what is the unrealized gain/loss of this example on 1/4?

  • there's actually a business / website out there which does exactly that, and it's used very widely by Crypto Folks to do taxes etc.
    – Fattie
    Feb 13, 2021 at 18:36

1 Answer 1


That depends on how you determine the Cost Basis of the investment (which shouldn't be all that different from how you calculate the cost basis of stock market portfolios).


The common methods are:

  • FIFO (first in, first out) and
  • by Lot ID (the "serial number" of the purchase; brokerages supply this for you when purchasing stocks; the place where you buy your coin might supply one for you, or you might have to make one yourself).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.