A wash sale is a transaction in which an investor sells a losing security to claim a capital loss, and within 30 days before or after the sale, they: Buy substantially the same securities ...