Portfolio basics
What did your remaining shares actually cost?
By VestRadar · Updated
You buy 100 shares at $40, then another 100 at $60. You’ve spent $10,000 on 200 shares, so the average is $50 per share.
Then you sell half the position.
What did the remaining 100 shares cost: $40 each, $50, or $60?
All three numbers can follow from the same trades. The difference is which purchase costs are assigned to the shares you sold, and which stay with the shares you still own. That is what FIFO, LIFO, average cost, and specific lot selection decide.1
This also explains why a broker and a portfolio tracker can show different costs for the same position. To understand a discrepancy, first check what each number includes.
The purchase price is only the beginning
Cost basis starts with the amount paid to acquire an investment. Purchase commissions and certain later adjustments can also be included. When you sell, the cost assigned to the shares sold is compared with the sale proceeds to work out the realized gain or loss.2
For the position you still hold, there are two related figures: the remaining cost basis of the whole position and the average cost per share. A remaining basis of $5,000 across 100 shares means an average of $50.
That average does not tell you how the next sale will be calculated. A broker can display a single average while keeping individual purchase lots underneath it. The disposal method determines which costs leave the position when shares are sold.3
For the examples below, we’ll leave out fees, taxes, dividends, and currency conversion. They matter, but the difference between the methods is easier to see without them.
What happens when you sell part of a position?
A lot is a batch of shares acquired in a particular transaction. In our example, you have two lots: 100 shares bought at $40 and 100 bought at $60.
FIFO and LIFO both work with lots. They choose them in a different order.3
Now suppose you sell 100 shares at $70, receiving $7,000.
FIFO: the oldest purchases go first
FIFO stands for first in, first out. The sale is matched against your earliest purchases.1
Here, the 100 shares bought at $40 are treated as sold. Their cost was $4,000, so the sale produces a realized gain of $3,000.
The 100 shares bought at $60 remain. Their total basis is $6,000, or $60 per share.
Before the sale, the position’s average was $50. After the sale, the remaining shares have an average cost of $60. You haven’t bought anything more expensive. You’ve removed the cheaper lot from the calculation.
LIFO: the newest purchases go first
LIFO means last in, first out. It matches the sale against the most recent purchases instead.1
This time, the 100 shares bought at $60 are treated as sold. Their basis is $6,000, leaving a realized gain of $1,000.
The older shares remain at $40 each, with a total basis of $4,000.
LIFO is not the same as “sell the most expensive shares first.” It does that in this example only because the later purchase was more expensive. If you bought more shares after a price drop, the newest lot might be the cheapest one.
Average cost: each share carries the same cost
Under average cost, the purchases are pooled. The $10,000 spent on 200 shares gives every share a cost of $50.4
Selling 100 shares therefore removes $5,000 of basis. Against the $7,000 sale proceeds, that produces a realized gain of $2,000.
The remaining 100 shares still have a total basis of $5,000 and an average cost of $50.
A partial sale does not, by itself, change the average cost per remaining share under this method. It reduces the quantity and the total basis in the same proportion. The sale price determines the realized profit, not a new acquisition cost for the shares left behind.
Specific identification: you choose the lots
With specific identification, you choose which purchased shares the sale should use, subject to the broker’s procedures and the applicable tax rules.5
You could sell the entire $40 lot, reproducing FIFO. You could sell the entire $60 lot, reproducing LIFO. Or you could choose a mixture.
For example, sell 40 shares from the $40 lot and 60 from the $60 lot. The assigned cost is $1,600 + $3,600 = $5,200. Your realized gain is $1,800, and the remaining position has a basis of $4,800.
High-cost-first and low-cost-first methods automate a particular lot-selection rule. They are not the same as averaging the position. A tax-oriented selection can also consider holding periods, not just purchase prices.5
Changing a selection in a tracker does not change the lots recorded by your broker. For tax reporting, that selection has to follow the relevant identification and confirmation requirements.5
Different profit figures, the same money
Suppose the remaining shares are still worth $70 each immediately after the sale. Here is where the same $4,000 total gain appears under each method:
| Method | Realized gain | Remaining basis | Unrealized gain | Total gain |
|---|---|---|---|---|
| FIFO | $3,000 | $6,000 | $1,000 | $4,000 |
| LIFO | $1,000 | $4,000 | $3,000 | $4,000 |
| Average cost | $2,000 | $5,000 | $2,000 | $4,000 |
| Specific lots, as chosen above | $1,800 | $4,800 | $2,200 | $4,000 |
You spent $10,000, received $7,000 from the sale, and still own shares worth $7,000. That is a $4,000 gain before costs and taxes, whichever row you use.
The method changes how that gain is divided between realized and unrealized profit. It does not change the trades or create additional money.
That does not make the choice irrelevant. Tax rules can make the timing and classification of realized gains important. Nor is every method available for every asset or jurisdiction. For example, U.S. average-basis rules are restricted to eligible holdings; they are not a general election for all ordinary stock purchases.6
What changes when you buy more?
Continue from the sale above. You have 100 shares left, and later buy another 100 at $30.
With moving average cost, the remaining basis was $5,000. The new purchase adds $3,000. You now have 200 shares with a total basis of $8,000, so the new average is $40.
The calculation uses the cost of the shares still held plus the new purchase. Costs already assigned to a sale stay out.
Adding all three purchases would give $13,000 across 300 shares, or about $43.33 per share. That is an average of historical purchases, but it is not the moving-average basis of the current position. It includes costs already assigned to the sale.
The same new purchase produces different remaining positions under the lot-based methods. With FIFO, you keep 100 shares at $60 and add 100 at $30: $9,000 in total, or a displayed average of $45. With LIFO, you keep 100 at $40 and add 100 at $30: $7,000 in total, averaging $35.
Those averages summarize the remaining lots. They do not replace the rule used for the next sale.
If you sell the entire position, its remaining basis is fully allocated to those sales. A later purchase starts a new open position; it is not averaged together with shares you no longer own. That describes the transaction-based calculation before any special tax adjustments.
Cost basis is not the same as cash break-even
There is another calculation that can look like cost basis but answers a different question.
Before that additional purchase, you had spent $10,000 and received $7,000 from selling half the position. Your net cash outlay was $3,000, with 100 shares remaining.
Divide one by the other and you get $30 per share.
That is the price at which selling the remaining shares would recover your net cash outlay, ignoring costs and taxes. It is not the $50 average-cost basis, the $60 FIFO basis, or the $40 LIFO basis of those shares.
The distinction becomes important after several profitable sales. A cash-recovery calculation can fall to zero or even become negative. That does not make the remaining shares risk-free. If they are worth $7,000 today, a fall to zero would still reduce your wealth by $7,000.
Shares acquired through options
Options introduce a separate question: what happens to the premium when the option turns into a stock transaction?
The examples here use physically settled stock options with a standard contract covering 100 shares. Adjusted contracts can have different deliverables, and cash-settled options do not deliver shares at all. Employee stock-option grants are outside the scope of these examples.7, 8
Two familiar ways to acquire shares are exercising a call you bought and being assigned on a put you sold. The premium affects their effective acquisition costs in opposite directions.9
You exercise a call you bought
Suppose you buy a call with a $50 strike and pay a premium of $3 per share, or $300 for the contract.
When you exercise it, you pay another $5,000 and receive 100 shares. Across the call purchase and exercise, you have paid $5,300.
The stock transaction itself takes place at $50 per share. Include the premium paid to acquire the call, and the effective acquisition cost is $53 per share.9
A transaction record showing $50 is therefore not enough to tell you whether the premium has been accounted for. You need to see whether the $300 appears in the stock’s basis or remains separately attributed to the option in the analytical view.
A put you sold is assigned
Now suppose you sell a put with a $50 strike and receive $2 per share, or $200.
You are assigned and buy 100 shares for $5,000. After including the premium received, your net outlay is $4,800, or $48 per share.10
Here, the premium reduces the effective acquisition cost. With the purchased call, it increased it.
The broker’s trade record can show the stock purchase at $50 while a premium-adjusted basis shows $48. Those numbers describe different parts of the same transaction history.
The premium must appear once, not twice
Take the assigned-put example and suppose the shares are now worth $47 each.
A tracking view that keeps the stock at the $50 strike shows a $300 stock loss. If it attributes the completed option’s $200 premium separately, the combined result is a $100 loss.
A view that incorporates the premium into a $48 stock basis shows a $100 unrealized stock loss instead. The same $200 must not then be added again as separate profit.
| Analytical presentation | Stock result at $47 | Premium attributed separately | Combined result |
|---|---|---|---|
| Stock recorded at the $50 strike | −$300 | +$200 | −$100 |
| Stock basis adjusted to $48 | −$100 | $0 | −$100 |
These are two ways to present the economics for tracking purposes. The applicable tax rules determine the tax treatment.
Under the standard U.S. federal rules for purchased and written equity options, an exercised call’s cost is added to the acquired stock’s basis, while the premium from an assigned written put reduces the acquired stock’s basis. Other jurisdictions may treat the transactions differently.6
Adding the new shares to an existing position
Suppose you already hold 100 shares with a total basis of $4,000, and the assigned put adds another 100 shares.
Using the premium-adjusted acquisition cost of $4,800, a moving-average calculation gives $8,800 across 200 shares: $44 per share. Recording the new shares at the $5,000 strike cost instead gives $45, with the option result kept separately.
A lot-based calculation can retain the new shares as their own lot instead. There are two separate decisions here: what cost enters the position when the shares arrive, and which costs leave it when you later sell.
What about shares sold through options?
Assuming you own the shares being delivered, assignment on a covered call and exercise of a purchased put result in a sale, not a new stock purchase. The premium then affects effective sale proceeds rather than the acquisition cost of a new holding.9
For a covered call with a $55 strike and a $1.50 premium received, effective proceeds are $56.50 per share before fees. U.S. tax treatment adds the assigned call’s premium to the stock sale proceeds.11
For a purchased put with a $55 strike and a $1.50 premium paid, effective proceeds are $53.50 per share before fees. U.S. tax treatment subtracts the exercised put’s cost from the stock sale proceeds.6
You still need a rule for the cost of the shares delivered. If your holding contains several purchase lots, the option’s strike does not tell you which of those lots the sale closes.
Earlier premiums are a different calculation
Suppose the put assigned at $50 was not your first trade in that stock. Before it, you earned another $600 from separate puts that expired worthless.
You might subtract those earlier profits as well and calculate a strategy-level cash break-even of $42 per share: $5,000 paid for the stock, less the assigned put’s $200 premium, less $600 earned earlier, divided by 100 shares.
That can be useful for tracking the whole sequence. But it is not the same as the $48 acquisition basis resulting from the assigned put alone. Under standard U.S. treatment, premiums on earlier expired written options are separate realized gains, rather than automatic reductions to the basis of shares acquired later.6
The same distinction applies when tracking repeated covered calls or rolled options. A strategy’s cumulative result and the remaining stock position’s cost basis are related, but they are not interchangeable.
How VestRadar calculates cost basis
VestRadar uses moving weighted average cost for its position accounting. It rebuilds the remaining basis from the transaction history and allocates each sale at the average cost at that point.
Purchases, sales, and fees
For an ordinary purchase entered manually, VestRadar adds the purchase amount and its purchase fee to the remaining basis, then divides by the new quantity. A fee rebate reduces that added cost.
A partial sale removes basis at the existing average cost. Realized profit or loss is the sale proceeds after the sale fee, minus the basis assigned to the shares sold. The average cost of the remaining shares stays unchanged.
In the running example, the average is $50 after the first two purchases, still $50 after selling half, and $40 after buying another 100 shares at $30.
Here is a separate example with fees, all in a USD portfolio. Buy 100 shares at $50 and pay a $5 purchase fee. The basis is $5,005, or $50.05 per share. Later, sell 40 shares at $60 and pay a $3 sale fee. Net proceeds are $2,397, and the basis assigned to the sale is $2,002, leaving $395 of realized profit. The remaining 60 shares retain $3,003 of basis, still $50.05 each.
Trade fees are already included in that calculation. Subtracting them again from the resulting profit would count them twice. Standalone portfolio fees, dividend income, interest income, and taxes are recorded separately; a cash dividend does not reduce the stock's average cost.
Imported acquisition cost and execution price
An IBKR import can provide an acquisition cost that already includes a purchase commission or a supported adjustment. VestRadar uses that imported cost for the opening shares without adding the purchase fee again. The original execution price remains visible in the transaction history.
This does not switch the position to the broker's disposal method. If a later IBKR sale carries a FIFO lot cost, VestRadar still removes the sold shares at its own moving average. Imported opening cost and the method used to allocate a later sale are separate parts of the calculation.
Cost basis and profit or loss are calculated in the portfolio's base currency. Foreign-currency trade amounts and fees use transaction-date conversion; the current holding is valued using current price and exchange-rate inputs. A supported stock split preserves the position's total basis while changing the quantity and cost per share.
Shares received through put assignment
VestRadar can import a supported stock execution resulting from exercise or assignment. There is also a specific basis adjustment for a verified IBKR put assignment: the linked option cost is subtracted from the stock acquisition cost before the shares enter the moving average.
The importer checks the linked stock and option records, the assignment event, contract multiplier, timing, and delivered quantity. When complete originating-lot evidence is present, it must agree with the adjusted cost. The importer uses the option cost linked to the delivered shares; it does not infer a premium from the strike alone or subtract profits from earlier options.
With the fee-free example above, the stock purchase is 100 shares at the $50 strike and the linked put premium is $200. The acquisition basis is $5,000 − $200 = $4,800, or $48 per share, while the stock execution price remains $50.
At a market price of $47, those shares have a value of $4,700 and an unrealized loss of $100. The $200 premium is already reflected in the stock basis; adding it again as separate profit would double-count it. If you already held 100 shares with $4,000 of basis, the combined holding becomes 200 shares with $8,800 of basis, averaging $44.
This is a supported stock-basis calculation. VestRadar v1 does not maintain option positions or calculate option profit, loss, or the cumulative result of an options strategy. Cash from an isolated option execution can appear as a deposit or withdrawal in the tracked portfolio. Other option lifecycle events do not have a general premium-allocation model in v1.
When the import cannot establish the necessary link or cost, it does not invent a premium adjustment. Review the import warnings and the acquisition cost stored on the stock transaction before comparing it with a premium-adjusted broker figure.
Complete history matters
The calculation depends on the transactions and acquisition costs available in the portfolio. Missing history or a missing acquisition price can make basis and related profit figures unavailable or partial; VestRadar does not treat an unknown acquisition cost as zero.
For a comparison with your broker, use the same holdings, history, dates, and currency, then compare both the acquisition inputs and the disposal method.
Why VestRadar and your broker may show different numbers
The first thing to check is the method. In our example, a tracker using moving average keeps the remaining shares at $50 after the sale. A broker using FIFO keeps them at $60. The purchase prices are the same; the difference comes from how the sale was matched.1
An average on screen does not necessarily mean average-cost accounting. It may simply summarize the lots still open. Check the disposal method behind the figure, not just the column heading.3
Fees and option premiums may appear in different places. A stock transaction price is not necessarily its adjusted basis. Even within one broker’s reports, performance sections can handle commissions differently. Interactive Brokers, for example, documents separate commission presentation for mark-to-market performance and netting of commissions into basis and proceeds for several matched-trade methods.12
Tax adjustments can change the comparison. A tax basis may include adjustments such as a deferred wash-sale loss or a return-of-capital distribution. A simple reconstruction from purchase and sale prices will not reproduce an adjustment it has not been given.2, 6
The currency must match. A $50 acquisition cost and its euro equivalent are not directly comparable. Nor is the historical euro cost necessarily the same as converting $50 at today’s exchange rate. For example, a $5,000 purchase at €0.90 per dollar costs €4,500. If those shares are still worth $5,000 when the dollar buys €0.95, their value is €4,750—a €250 change even though the dollar price is unchanged.
The history must match too. A share count is not enough to reconstruct basis. Missing purchases, fees, corporate actions, or acquisition records from an earlier broker can leave two systems with different inputs. FINRA specifically recommends checking broker-reported basis against your own records rather than assuming it is always complete.13
A difference in remaining basis can be legitimate. A missing premium or duplicated fee is still an error.
Start by comparing the same holdings, dates, currencies, and transaction history. Then check which costs were assigned to sales and where fees and premiums were recorded. Once those are aligned, it becomes much easier to see whether you are looking at a different accounting method, a different metric, or a calculation that needs correcting.
These examples explain portfolio accounting. They are not instructions for preparing a tax return; the applicable tax rules depend on the asset, transaction, and jurisdiction.
Sources
- Charles Schwab, Save on Taxes: Know Your Cost Basis.
- Vanguard, Cost basis & taxes.
- Fidelity, Capital gains and cost basis, especially actual-cost accounting and disposal methods.
- Vanguard, Average cost method.
- Vanguard, Cost basis methods available at Vanguard.
- IRS, Publication 550 (2025), Investment Income and Expenses, sections on stock identification, average basis, puts and calls, and wash sales. The U.S. examples are not presented as universal tax rules.
- Options Industry Council, Options Basics.
- Options Industry Council, Equity vs. Index Options.
- Options Industry Council, Exercising Options, especially “What’s the Net?”
- Options Industry Council, Cash-Secured Put.
- Fidelity / The Options Institute at CBOE, Tax implications of covered calls.
- Interactive Brokers, Realized & Unrealized Performance Summary.
- FINRA, Cost Basis Basics.
Which cost-basis method do you need?
Do you use FIFO, LIFO, moving average, or specific lots? Tell us which method you would like to use in VestRadar and why.