Skip to content
All library documents

FIFO and LIFO Lot Accounting: Realized, Unrealized, and Total P&L

Article Quant Q&A · Author: nimo23

Summary

The document works through FIFO and LIFO lot accounting for a sequence of buys and sells, then marks the remaining position to market. It identifies an error in the initial LIFO calculation: the corrected lot cost basis produces the same total P&L as FIFO, while the split between realized and unrealized P&L can depend on the convention. The example's final holdings have the same aggregate cost under both methods by coincidence.

FIFO and LIFO are accounting conventions for assigning costs to sold lots; neither is inherently more precise. The answer notes FIFO is commonly used in futures trading, while any required method may depend on industry standards or regulation. The source does not establish a specific regulatory requirement, and its example should not be taken as evidence that remaining lot costs will match across methods in other trades.

Key ideas

  • FIFO and LIFO assign different purchase lots to sales, changing realized P&L.
  • With consistent lot accounting and the same marked position, total P&L should be invariant to the allocation method.
  • Unrealized P&L adjusts alongside realized P&L when the lot assignment changes.
  • Neither FIFO nor LIFO is inherently more precise; applicable conventions may depend on market practice or rules.

Tags

Full text
# PnL with FIFO and LIFO


# PnL with FIFO and LIFO












I have the following trades:

```
Sequence Side Quantity @ Price
1.       Buy    12     @ 100
2.       Buy    17     @ 99
3.       Buy    3      @ 103
4.       Sell   9      @ 101
5.       Sell   4      @ 105

with sold quantity = 9+4 = 13
and current position size = (12+17+3)-13 = 19
and markPrice = 99
```

I want to calculate the `netPnL`, `realizedPnl` and `unrealizedPnl` by using the most precise valuation type. I only know 3 valuation types: FIFO, LIFO, WAC. I did not choose WAC because it is not precise enough. So I want to choose either FIFO or LIFO. Here the calculations:

FIFO:

```
realizedPnL = (9*101 + 4*105) - (12*100 + 1*99) = +30
unrealizedPnL = 19*99 - (16*99 + 3*103) = -12
netPnL = 30 + (-12) = 18
```

LIFO:

```
realizedPnL = (9*101 + 4*105) - (3*103 + 10*100) = +20
unrealizedPnL = 19*99 - (7*99 + 12*100) = -12
netPnL = 20 + (-12) = 8
```

Now my questions:

- Are the calculations right? I thought that the `netPnl` must be always the same - regardless of the valuation type. But this is not the case here. Why?

- Which is more precise? FIFO or LIFO? Which should I use?

- Is there any other valuation type which is more precise than FIFO or LIFO? I need the most accurate valuation type.

EDIT:

The error was within the LIFO calculation:

Instead of

```
realizedPnL = (9*101 + 4*105) - (3*103 + 10*100) = +20
```

this must be used:

```
realized PnL = (9*101 + 4*105) - (3*103 + 10*99) = +30
```

## Answer by nbbo2 (score 4, accepted)

https://quant.stackexchange.com/a/53422

You are right that the Total P&L (or as you call it the Net P&L) must be the same for the two methods, so something went wrong. In addition, by a strange coincidence, the realized P&L's although different (9,21 versus 6,24) add up to the same amount at the end (30), which does not usually happen.

Here are my calculations

```
First let's use FIFO:
=====================

After the three buys we have the following Lot Table:
Lot Shrs Price Extensn
  1   12   100    1200
  2   17    99    1683
  3    3   103     309
      --          ----      
  Tot 32 at cost  3192

Sell 9 at 101
take 9 from lot 1
realized P&L on this trade = 9(101-100) = 9
Updated lot table:
Lot Shrs Price Extensn
  1    3   100     300
  2   17    99    1683
  3    3   103     309
      --          ----
total 23 at cost  2292

Sell 4 at 105
take 3 from lot 1 and 1 from lot 2
realized P&L on this trade = 3(105-100)+1(105-99)= 21
Updated lot table:
Lot Shrs Price Extensn
  1    0   100       0
  2   16    99    1584
  3    3   103     309
      --          ----
total 19 at cost  1893

mark to market of final holdings
value =19*99 = 1881
cost of final holdings = 0*100+16*99+3*103 = 1893
unrealized P&L = 1881-1893 = -12
cumulative realized P&L = 9+21=30
total P&L = 30-12 = 18

Now let's do it again using LIFO this time:
===========================================

After the three buys we have the following Lot Table:
Lot Shrs Price Extensn
  1   12   100    1200
  2   17    99    1683
  3    3   103     309
      --          ----      
  Tot 32 at cost  3192

Sell 9 at 101
take 3 from lot 3 and 6 from lot 2
realized P&L on this trade = 3(101-103)+6(101-99) = 6
Updated lot table:
Lot Shrs Price Extensn
  1   12   100    1200
  2   11    99    1089
  3    0   103       0
      --          ----
total 23 at cost  2289

Sell 4 at 105
take 4 from lot 2
realized P&L on this trade = 4(105-99) = 24
Updated lot table:
Lot Shrs Price Extensn
  1   12   100    1200
  2    7    99     693
  3    0   103       0
      --          ----
total 19 at cost  1893 /*by coincidence we again have 1893, unusual */

mark to market of final holdings
value =19*99 = 1881
cost of final holdings = 12*100+7*99+0*103 = 1893
unrealized P&L = 1881-1893 = -12
cumulative realized P&L = 6+24 = 30
total P&L = 30-12 = 18
```

Now to answer your questions:

- The Net P&L (realized+unrealized) must be the same for both, actually for all three, methods. Only the split between realized and unrealized could be different.

- Neither FIFO nor LIFO is "more precise". In futures trading we generally use FIFO. An accountant once told me the CFTC requires FIFO for futures trading accounts, but frankly I have never come across the law or regulation that says this explicitly, and I have never researched it.

- As mentioned I do not think one method is more precise, but a method may be required or suggested by industry standards or regulations.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.