What Is Weighted average cost?
Weighted average cost (WAC) is the acquisition cost per unit still held under average-cost accounting. Buying 30 units at 40 USD and 10 at 60 USD gives a WAC of (1,200 + 600) / 40 = 45 USD before fees. Selling 10 units at 50 USD books 50 USD of realised profit and loss and leaves the other 30 with the same 45 USD unit cost. A later purchase changes that average. Include acquisition fees consistently when comparing it with a sale price.
For an application to eligible US mutual fund shares, the IRS illustrates how to divide total acquisition cost by the number of shares held. See the IRS average-basis example.