FIFO

RevoGain uses the FIFO (First In, First Out) accounting method

About FIFO

When calculating trade gains, RevoGain uses the FIFO (First In, First Out) method when calculating stocks or crypto trading gains.

As its name implies, when using the FIFO method, the assets that were bought first are the ones to be sold first.

A stock trading gain example

Let's assume we have the following Buy and Sell trades.

| Date                | Ticker | Type | Quantity   | Unit Price | Amount | Currency |
|---------------------|--------|------|------------|------------|--------|----------|
| 23/12/2020 14:30:21 | TSLA   | BUY  | 0.15778843 | 633.76     | 100    | USD      |
| 23/12/2020 14:45:22 | TSLA   | BUY  | 0.07993605 | 625.5      | 50     | USD      |
| 19/04/2021 19:09:54 | TSLA   | SELL | 0.08424481 | 712.21     | 60     | USD      |
| 19/04/2021 19:10:52 | TSLA   | SELL | 0.15286659 | 713.04     | 109    | USD      |

Gain is realized at sell time, and since we have two SELL trades, we need to calculate the trading gain that was realized for each of those two selling operations.

Therefore, when applying the FIFO accounting method, this is what we get:

| Ticker | Sell Date           | Buy Date            | Sell Price | Buy Price | Quantity   | Gain amount |
|--------|---------------------|---------------------|------------|-----------|------------|-------------|
| TSLA   | 2021-04-19 19:09:54 | 2020-12-23 14:30:21 | 712.21     | 633.76    | 0.08424481 | 6.609005    |
| TSLA   | 2021-04-19 19:10:52 | 2020-12-23 14:30:21 | 713.04     | 633.76    | 0.07354362 | 5.830538    |
| TSLA   | 2021-04-19 19:10:52 | 2020-12-23 14:45:22 | 713.04     | 625.5     | 0.07932297 | 6.943933    |

Next, I'm going to explain line-by-line how the FIFO strategy works.

Calculating the gain for the first SELL position

The first SELL position for TSLA happened on 19/04/2021 19:09:54. And, the first BUY position was executed on 23/12/2020 14:30:21.

The quantity of the first SELL position is 0.08424481, while the quantity of the first BUY position is greater, being 0.15778843.

So, the gain for the first SELL position can be covered entirely by the first BUY position, and we get a gain of 0.08424481 X ($712.21 - $633.76) = $6.609005.

| Ticker | Sell Date           | Buy Date            | Sell Price | Buy Price | Quantity   | Gain amount |
|--------|---------------------|---------------------|------------|-----------|------------|-------------|
| TSLA   | 2021-04-19 19:09:54 | 2020-12-23 14:30:21 | 712.21     | 633.76    | 0.08424481 | 6.609005    |

By multiplying the quantity sold, 0.08424481, with the price difference between the time we sold and the time we bought, ($712.21 - $633.76), we get a gain of $6.609005.

Notice that we only sold 0.08424481 out of 0.15778843 that was the original quantity of the first TSLA BUY position. So, the first TSLA BUY position now has a balance of (0.15778843 - 0.08424481) = 0.07354362.

Calculating the gain for the second SELL position

The second SELL TSLA position for TSLA happened on 19/04/2021 19:10:52. And, since the first BUY position that was executed on 23/12/2020 14:30:21 still has an unsold balance of (0.15778843 - 0.08424481) = 0.07354362, we can use that when calculating the gain of the second SELL position.

However, since the second SELL TSLA position has a quantity of 0.15286659, it means the first position can be liquidated entirely:

| Ticker | Sell Date           | Buy Date            | Sell Price | Buy Price | Quantity   | Gain amount |
|--------|---------------------|---------------------|------------|-----------|------------|-------------|
| TSLA   | 2021-04-19 19:10:52 | 2020-12-23 14:30:21 | 713.04     | 633.76    | 0.07354362 | 5.830538    |

So, the gain realized by selling the remaining 0.07354362 from the first BUY position generates a gain of 0.07354362 X ($713.04 - $633.76) = $5.830538.

But, we are not done since we only sold 0.07354362 out of 0.15286659 from the second SELL position. So, the SELL position has a remaining balance of (0.15286659 - 0.07354362) = 0.07932297.

Therefore, we proceed with the next consecutive BUY position:

| Date                | Ticker | Type | Quantity   | Unit Price | Amount | Currency |
|---------------------|--------|------|------------|------------|--------|----------|
| 23/12/2020 14:45:22 | TSLA   | BUY  | 0.07993605 | 625.5      | 50     | USD      |

Since the remaining 0.07932297 balance of the second SELL position matches exactly the quantity of the second BUY position, we can liquidate the remaining balance of the second SELL position entirely, and a new trading gain is being realized, 0.07932297 X ($713.04 - $625.5) = $6.943933:

| Ticker | Sell Date           | Buy Date            | Sell Price | Buy Price | Quantity   | Gain amount |
|--------|---------------------|---------------------|------------|-----------|------------|-------------|
| TSLA   | 2021-04-19 19:10:52 | 2020-12-23 14:45:22 | 713.04     | 625.5     | 0.07932297 | 6.943933    |

Is that all?

Unfortunately, there's more. Stocks can undergo splits or reverse splits, meaning that the base price changes if you happen to calculate the gain of a SELL position that happened after the stock split by using a BUY position that was issued before the stock split.

What if I have hundreds of such transactions?

Applying the FIFO strategy for hundreds of stocks and crypto transactions can be a very daunting task, and that's exactly why we created RevoGain for you.

With RevoGain, you can calculate your gains in just a few seconds so you can enjoy spending your time doing the things you love instead.