The wash-sale rule was designed to discourage people from selling securities at a loss simply to claim a tax benefit. A wash sale occurs when you sell a security at a loss and then purchase that same security or “substantially identical” securities within 30 days (before or after the sale date) - https://www.schwab.com/resource-center/insights/content/a-primer-on-wash-sales