::
When you purchase you need to make record of the date, the amount of money you spent and the amount of coin you received.
You do this line by line for every purchase you make, different dates, different values, different price points.
Then when you sell, or trade (creating a taxable event) you need to subtract that volume, and cost basis from your purchase.
You need to use a standardized measure, like first in first out, or lowest purchase price out first..
These sales can all me fractional, and do not need to be the same volume (amount of coin you originally purchased)
You can buy a whole Bitcoin for 10 dollars, another for 20 dollars, then sell .5 of a Bitcoin for 30 dollars, and reduce the first Bitcoin you bought to .5,
It’s math, accounting, and it’s your responsibility to keep track, or use a crypto tax calculator.. but those are awful and will make errors you will need to fix.
Crypto taxes are a pain.