(The example below is, of course, unrealistically simple, just for the sake of illustration.)
Suppose that I made the following purchases and sales of shares of some stock X:
| 01/15/2021 | bought | 10 shares | $50/share | -$500 |
| 02/15/2021 | bought | 10 shares | $60/share | -$600 |
| 03/15/2021 | bought | 10 shares | $70/share | -$700 |
| 04/15/2021 | bought | 10 shares | $80/share | -$800 |
| 05/15/2021 | bought | 10 shares | $90/share | -$900 |
| 06/15/2021 | bought | 10 shares | $100/share | -$1,000 |
| 07/15/2021 | bought | 10 shares | $110/share | -$1,100 |
| 08/15/2021 | bought | 10 shares | $120/share | -$1,200 |
| 09/15/2021 | bought | 10 shares | $110/share | -$1,100 |
| 10/15/2021 | bought | 10 shares | $100/share | -$1,000 |
| 11/15/2021 | bought | 10 shares | $90/share | -$900 |
| 12/15/2021 | bought | 10 shares | $80/share | -$800 |
|------------+--------+------------+------------+----------|
| 2021 TOTAL | | 120 shares | | -$10,600 |
|------------+--------+------------+------------+----------|
| 03/15/2022 | sold | 42 shares | $40/share | $1,680 |
| 09/15/2022 | sold | 21 shares | $30/share | $630 |
|------------+--------+------------+------------+----------|
| 2022 TOTAL | | 63 shares | | $2,310 |
Clearly, the sales I made in 2022 (63 shares for a total of $2,310) represent a capital loss, since the sale prices were all below the original purchase prices.
I want to claim this capital loss as a deduction when I file my U.S. income taxes for year 20221 to the Internal Revenue Service (IRS).
Q: How I should compute the cost basis for the 63 shares I sold in 2022 so as to maximize the capital loss that I (lawfully!) report to the IRS.
Here are some possibilities that come to mind.
Naively, if I wanted to maximize my capital loss (for the purposes of reporting them to the IRS), I would calculate the cost basis for the sold shares as though they were the ones that I paid the most for in 2021. Here's such calculation:
| 10 shares | $120/share | $1,200 |
| 20 shares | $110/share | $2,200 |
| 20 shares | $100/share | $2,000 |
| 13 shares | $90/share | $1,170 |
|-----------+------------+--------|
| | TOTAL | $6,570 |
With this cost basis, my capital loss would be $6,570 − $2,310 = $4,260.
Another possibility would be that I average out the purchase prices. I bought a total of 120 shares in 2021, and paid $10,600 for them. This corresponds to an average price of ($10600/120) per share. Therefore, the cost basis for the 63 shares that I sold in 2022 would be 63 × ($10600/120) = $5,565. With this cost basis, my capital loss would be $5,565 − $2,310 = $3,255.
Of course, I would prefer the first approach above, but I don't know if it would be acceptable to the IRS. (Actually, I don't know if any of the calculations shown above would be acceptable to the IRS.)
1 And possibly for some subsequent years as well, as carry-over, assuming that the total capital loss exceeds the maximum I can claim as deduction in one year.