What happens is tax software, unless specifically told (and some will ask) will assign a cost-basis of $0 to something it doesn't know about, which makes the whole $15 appear as a capital gain.
You have to tell the software about your cost basis, which is only a problem if you're mining. It's smart enough to figure out buying and selling on the same platform, but it is not smart enough to figure out that some income was related to later sales and track your cost basis unless you make those connections yourself.