So I have recently gone into investing crypto and have made good money on it. However I recently started thinking about the taxes on my investments. I'm not a day trader but I do sell and buy the same crypto frequently making $20-$30 each time I do so. While I have made good money doing this I don't know how it will be taxed.

So if I hypothetically purchased crypto at $20 and then sold it when it was valued at $300 and then bought the same amount back when it was $280 I would have theoretically made $280 from the first investment but then I would buy back the same share at $280 making $20. Would I be taxed on the $20 or on the $280. What if I sold that crypto again at $350 and bought it back at $310. How would the capital gains be drawn and am I not making as much as if I just waited for it to go straight from $20 to $350.