Portfolio math

Average cost basis: the math behind your profit number

You bought a stock at €50, more at €80, more at €40. It now trades at €60. Are you up or down? Depends who's counting.

That answer sounds evasive, so let's be precise about what it means. Your wealth is a fact: shares times price, minus what you paid in total. But the moment you buy the same security more than once at different prices, any per-share profit figure requires a decision about which purchase a given share "belongs" to. That decision is an accounting convention, and different conventions produce different-looking numbers from identical trades. This article covers the two conventions you'll actually meet, and the handful of details, fees, currency, splits, that do more damage to profit numbers than either.

The average cost method

Many brokers and trackers (including BullBenchmark) use average cost: total money in, divided by total shares. In the example: (50 + 80 + 40) / 3 = €56.67 average. At €60 you're up about 6%. Sell one share and your realized gain is €60 minus €56.67, the average, not any specific lot.

Simple, stable, and it matches how most people actually think about a position.

It has one property worth knowing: your average only moves when you buy. Selling shares at any price leaves the average cost of the remaining shares untouched, it just realizes part of the gain or loss. This is why an average cost figure is calm compared to a FIFO ledger; there are no lots being consumed in sequence, just one pool of money and one pool of shares. It also means "averaging down" is exactly what it sounds like, and shows up in the number immediately.

A second example, with unequal lots

The one-share-per-purchase example hides something: in real portfolios the lots have different sizes, and the average is weighted by money, not by number of purchases. Say you bought 10 shares at €50 (€500), then 5 at €80 (€400), then 20 at €40 (€800). Total in: €1,700 for 35 shares, an average cost of €48.57, noticeably below the €56.67 from the equal-lot version, because most of your shares were bought cheap.

At €60, the position is worth 35 × €60 = €2,100 against €1,700 invested: up €400, or €11.43 per share, about 23.5%. This is why "I bought at €50, €80 and €40" tells you almost nothing by itself. The average that matters is weighted by how much you put in at each price, and a big cheap lot drags it down more than an expensive small one drags it up.

FIFO and the US way

US brokers often default to FIFO, first in, first out. Sell one share at €60 and your realized gain is measured against the first €50 share: +€10. FIFO makes your realized gains look different (often bigger, earlier), and US investors can even pick specific lots for tax optimization.

Neither method changes your actual wealth, only how it's split between "realized" and "unrealized" on paper. But if your tracker uses one method and your broker another, the per-position numbers won't match. That's usually the answer to "why does my tracker disagree with my broker".

Same sale, two stories

Run the unequal-lot position through both methods and watch the split move. You sell 10 of your 35 shares at €60. Under average cost, the realized gain is 10 × (€60 − €48.57) = €114.29, and the remaining 25 shares keep a cost basis of €1,214.29. Under FIFO, the sale consumes the oldest lot, the 10 shares bought at €50, for a realized gain of 10 × €10 = €100.00, leaving the remaining shares with a basis of €1,200.00.

Same trades, same cash, same portfolio, but one method reports €114.29 banked and the other €100.00. The difference didn't vanish, it moved into the unrealized column, waiting. Sell everything at €60 and both methods converge on the identical total gain of €400, because they must: accounting methods redistribute a fixed truth across time, they don't create or destroy it. Which is worth remembering the next time two apps show different profits on the same position, before assuming one of them is broken.

The details that actually bite

The choice between average cost and FIFO gets all the forum arguments, but in practice three duller details corrupt more profit numbers than the method ever will.

Fees. Is the €2 transaction fee part of your cost basis or booked separately? Small per trade; after 400 trades it's the difference between +€960 and honest numbers. For tax purposes fees usually belong inside the cost basis; we book them separately for visibility, so you can see exactly what your broker cost you.

FX. Buy a US stock as a European and your true cost basis is the euro amount at that day's rate. Track in dollars only, and years of EUR/USD drift quietly distort every position.

This one deserves emphasis because it fails silently. A US position can be up 10% in dollars and up 4% in euros, or up 16%, depending entirely on what the exchange rate did between your purchase dates and today. If your goal is knowing what your money did, the cost basis has to be recorded in your money, at the historical rate for each purchase, not one blanket rate applied later. We've written a longer piece on multi-currency portfolio tracking if you hold across several currencies.

Splits and ISIN changes. A 4:1 split doesn't quadruple your position's cost, but a naive tracker thinks it does. Corporate actions are where portfolio math goes to die; check that your tool handles them.

Taxes: where the method stops being a preference

One caveat before you file anything: several countries mandate a method for taxable gains, Germany requires FIFO, the UK uses Section 104 pooling. Per-position figures from any tracker are performance insight, not tax filings.

The practical rule: use whatever method makes your performance intelligible day to day, and when tax season arrives, compute gains the way your tax authority demands, from the broker's own records. The two jobs are different. A tracker answers "how is this position actually doing"; a tax return answers "what does the law say I owe." Confusing the two is how people end up either overpaying or having awkward correspondence with the revenue service.

When your tracker and your broker disagree

Sooner or later you will see two different profit figures for the same position and want to know which one is lying. Usually neither. Work through the causes in order of likelihood: a different cost method (average versus FIFO), fees booked inside versus outside the basis, currency converted at different dates or rates, and finally an unhandled split or ticker change. The first three produce small, stable discrepancies; the last produces spectacular ones, a position showing −75% after a 4:1 split is the classic.

BullBenchmark uses average cost, books fees separately, converts at each day's historical FX rate and handles splits, upload your export and check the numbers against your broker yourself. The first week is free, no card.

A final framing note: everything above is per-position bookkeeping. Whether your portfolio is doing well is a different question with its own math, see time-weighted versus money-weighted returns, and it's the one that determines whether the whole exercise is beating a simple index fund.

The first week of BullBenchmark is free, no card, upload the export you just downloaded and see where you stand.

Related: Realized vs unrealized gains