Gain and basis
The calculation first compares sale proceeds with the cost basis assigned to the units sold. When multiple purchase lots are involved, the selected basis method can change which acquisition costs are matched to the sale and therefore change the realized gain or loss. Holding dates are then used to distinguish short-term from long-term treatment.