A company I held shares in forced a buyback of a portion of my shares in them. Within 30 days, I then bought back that same number of shares to maintain my holding and basis. However, taking the two transactions together (the forced repurchase plus my subsequent buy back) I now have a net profit. Do I now decrease my basis in this stock, or do I treat the net profit as a capital gain in the current tax year? And what if I had made a net loss?