Capital gains are not that easy to define.
It's NOT the profit you make. In your example, getting $150 for the spending of $100 can be considered a profit of $50, and as such would be taxed as income. It doesn't really matter about the time difference when you bought and when you sold.
Essentially, if you buy to on-sell, you make a profit and that's what gets taxed.
Stocks and shares have a tendency to be traded on this simple approach, so the tax you pay is based on your total income (less legitimate expenditures).So, selling within the same year is just basic tax on your income.
Capital gains usually come over very long periods of time. Because the taxing would be over a long period (a number of tax years), it's not as simple as taking the difference between value at time A and value at time B. You have to assign the values over the financial years involved. And then there is the matter of expenditures for the item (including depreciation).
If you buy a house for example (primarily for your own use), do maintenance and renovations that make it worth more, all those expenses need to be taken into account, as well as the "windfall" amount of house prices going up. And what about situations like starting a company (Microsoft, for example): the initial stocks were about $1 per share. And there were maybe 1000 such shares. Now there's billions of shares, and they are worth, what? about $140 a share?
Add in the idea that a dollar in 2000 was worth more (in buying power) than a dollar in 2019....
This forum isn't the place to give a full view of just how complex capital gains taxes might be.