A wash sale is a sale of a security at a loss and repurchase of the same or substantially identical security shortly before or after.