A bond swap is the sale of one bond and the simultaneous purchase of another, broadly similar bond to improve a portfolio's position. Investors use swaps for several reasons: to realise a capital loss for tax purposes while keeping similar market exposure, known as tax-loss harvesting; to pick up higher yield; to lengthen or shorten duration in anticipation of rate moves; or to raise or lower credit quality.
A tax swap only works if the new bond is not "substantially identical" to the one sold. In the United States, buying a substantially identical security within 30 days before or after a loss sale triggers the wash-sale rule, which disallows the loss for the time being. Investors therefore usually change the issuer, coupon or maturity. Swaps also carry costs, because bonds trade over the counter with dealer mark-ups and bid-ask spreads that can absorb the expected benefit.
Ref 1180001429