PSX TrackerKNOW MORE. EARN MORE.Log in

PSX Tracker guide

FIFO cost basis on the Pakistan Stock Exchange

When you sell shares, which purchase lots did you close? First-in, first-out (FIFO) answers that by matching sells to your oldest remaining buys first. That choice changes average cost, unrealized marks and realized profit — even when the sale price is identical. This article explains FIFO in practice, how it differs from weighted-average sheets, and how PSX Tracker models it. Educational only: NCCPL, CDC and broker statements remain authoritative for tax.

By PSX Tracker · Updated 16 October 2026 · How our guides are prepared

Start freeAll guides

What FIFO means in a portfolio

Imagine you bought the same symbol three times at different prices, then sold part of the position. FIFO closes the earliest open lots before newer ones. Your broker may document matching rules differently for tax forms; this guide describes the lot logic investors and trackers commonly use to reconstruct a book.

Without a rule, “average cost” becomes a blur. With FIFO, each sale has a clear trail back to specific buys, which makes later audits and exports easier to defend to yourself.

FIFO vs average / weighted cost

Two different questions

Average or weighted cost describes a position: what did the shares you still hold cost on average? FIFO describes a sell: which purchase lots did this disposal close?

Community Google Sheets often store only average cost. On a partial sell, that can disagree with FIFO-style lot matching used in PSX capital-gains education — a pattern repeatedly flagged on r/FIREPakistan tracker threads.

Worked mini-example (education only)

Buy 100 shares at 200, later buy 100 at 170, then sell 50 at 225. Under FIFO the 50 sold come from the first lot at 200, so the gain is driven by 225 − 200 (before fees), not by the blended average of 185. A sheet that only stores average cost can report a different realized figure even when the broker fill is identical.

This is education for personal ledgers — not a tax filing. Treat NCCPL, CDC and broker statements as authoritative.

Why matching changes your numbers

Unrealized gain compares market value with the cost of lots you still hold. Realized gain compares sale proceeds with the cost of lots you closed, including related charges when you record them.

Selling into older low-cost lots can realize more taxable-looking gain than selling newer high-cost lots at the same market price. That is not a tip to trade for tax optics — it is a reminder that lot order is part of the math.

If your ledger mixes fees incorrectly or duplicates buys, FIFO will faithfully produce wrong answers. Garbage lots in, garbage P&L out.

Same-day buys and sells

Intraday churn can distort long-term average cost if every minute trade stays in the lot stack. Many investors conceptually square same-day activity before it permanently reshapes basis.

PSX Tracker includes day-trade squaring behaviour so short-term round trips are less likely to quietly ruin the cost of shares you meant to keep. Still review busy days after imports.

Fees belong in what you paid

Commission, sales tax, CDC and similar charges are part of economic cost. Leaving them out makes break-even look better than reality.

Enter fees on the trade (or as your import mapping provides) so FIFO cost per share reflects what left your pocket.

How PSX Tracker helps

You record buys, sells and fees once. The app applies FIFO-style matching, shows open holdings and realized trades, and lets you export for reconciliation against broker contract notes.

After a large import, skim holdings quantities and a few realized lines before you trust year-end totals. Dividends and withholding belong in total return separately from share sells.

FAQ

Does PSX / NCCPL use FIFO or average cost when I sell shares? Capital-gains education for listed shares often walks FIFO-style lot matching. Your broker may still show an average buy price on the position screen — that average describes the open book, not which lot a partial sell closed. For filing, rely on NCCPL, CDC and broker records, not a tracker estimate.

Why does my broker show average buy price but my sale profit look different? Average cost blends all open lots into one number. FIFO assigns a partial sell to the oldest lots first, so realized gain can differ from “average × quantity sold.” Check lot order, dates and fees before assuming either number is wrong.

Should fees be in my FIFO cost basis? Yes for an economic ledger: commission, sales tax, CDC and similar charges belong in what you paid. Leaving them out makes break-even look better than reality.

Does a portfolio tracker file my PSX capital gains tax? No. Trackers may estimate realized gains with FIFO-style lots for personal records. They are not tax filers or personalized tax advisers — NCCPL/broker/CDC remain the source of truth.

What about same-day buys and sells? Intraday churn can distort long-term average cost if every round trip stays in the lot stack. Review busy days after imports; PSX Tracker includes day-trade squaring behaviour so short-term round trips are less likely to quietly ruin the cost of shares you meant to keep.

Sources and further reading

Primary references for FIFO education and community Sheets patterns. No competitor deep-links.

Bottom line

FIFO answers which lots a sell closed; average cost answers what the remaining position cost. Use both carefully, keep fees in the book, and reconcile against broker or CDC statements. PSX Tracker applies FIFO-style matching for your personal ledger — it does not file taxes.

This guide is educational and describes how PSX Tracker works. It is not investment, tax or legal advice. Confirm rules and figures with your broker, FBR guidance and professional advisors.

Corporate actions and partial sells

A bonus issue, a rights issue, or a stock split changes the number of shares without a normal buy. If you only store an average price and then apply FIFO later, the lot stack no longer matches the contract notes. Record the corporate action on the date the shares arrived, with the cost treatment you and your adviser agree, and keep the company notice beside the entry.

Partial sells across several years are where homemade sheets usually break. The oldest open lot might be from a different face value, a different broker, or a transfer in from another account. PSX Tracker consumes lots in date order, including transfer-ins, so a later sell does not silently use a blended price. If the quantity you sell is larger than the open lots, the ledger should show that gap instead of inventing a cost.

When you move shares between your own portfolios, the destination should keep the source lot’s cost, not a fresh market price. A market-price transfer would create a fake gain on a day you did not sell to anyone else.

Follow a partial sale from note to report

Illustrative records only: the following dates and prices are invented. Assume no fees or corporate actions so the lot-matching difference is visible.

Contract noteTransaction to recordQuantity × price
2 September 2026Buy — first lot100 × Rs 200 = Rs 20,000
9 September 2026Buy — second lot100 × Rs 170 = Rs 17,000
16 September 2026Sell — partial disposal50 × Rs 225 = Rs 11,250

In Reports → Transactions, check that there are exactly two buys and one sell, with the dates and quantities above. The sale consumes 50 shares from the first lot. Its FIFO cost is Rs 10,000 and its realized gain before fees and tax is Rs 1,250.

The remaining holdings are 50 shares at Rs 200 plus 100 at Rs 170: 150 shares with Rs 27,000 of remaining cost. A weighted-average method uses Rs 185 per share and reports Rs 2,000 on the same sale. The Rs 750 difference is a timing difference in allocated cost, not extra cash received.

PSX Tracker transaction history with sample buys and sells
Transaction history — a separate demo account. Use this screen to check the source rows; its amounts are not the worked example above. Tap to enlarge.
PSX Tracker realized profit and loss report
Realized P&L — a separate demo account. Reconcile the sale and matched cost before relying on the total. Tap to enlarge.

Common questions

Does PSX / NCCPL use FIFO or average cost when I sell shares?

Capital-gains education for listed shares often walks FIFO-style lot matching. Your broker may still show an average buy price on the position screen — that average describes the open book, not which lot a partial sell closed. For filing, rely on NCCPL, CDC and broker records, not a tracker estimate.

Why does my broker show average buy price but my sale profit look different?

Average cost blends all open lots into one number. FIFO assigns a partial sell to the oldest lots first, so realized gain can differ from “average × quantity sold.” Check lot order, dates and fees before assuming either number is wrong.

Should fees be in my FIFO cost basis?

Yes for an economic ledger: commission, sales tax, CDC and similar charges belong in what you paid. Leaving them out makes break-even look better than reality.

Does a portfolio tracker file my PSX capital gains tax?

No. Trackers may estimate realized gains with FIFO-style lots for personal records. They are not tax filers or personalized tax advisers — NCCPL/broker/CDC remain the source of truth.

What about same-day buys and sells?

Intraday churn can distort long-term average cost if every round trip stays in the lot stack. Review busy days after imports; PSX Tracker includes day-trade squaring behaviour so short-term round trips are less likely to quietly ruin the cost of shares you meant to keep.

Related guides

Best PSX Portfolio Tracker Alternatives to Excel and Google Sheets (2026) · Capital gains tax basics for Pakistani stocks · Realized vs unrealized P&L: meaning and example · Importing broker trades into PSX Tracker · Tracking PSX dividends and cash income · How PSX Tracker works: video and feature guide

Need help? Contact support →