You will have to keep your own spreadsheet of buys and sells. If you are into excel it's easy.
I prefer to keep the option of which purchases of the same stock I want to sell. Others just rely on the stock broking site to keep the records. Then it will always be the average.
At the end of the day it all evens out. That's why the tax office doesn't care.