FIFO P&L for Indian traders: why your broker number is often wrong

If you've ever added to a position in tranches — bought 100 shares of Reliance, then another 50 — and partially sold later, your broker's P&L and your real closed P&L can be very different numbers. FIFO accounting is what makes the difference.

What does FIFO mean?

FIFO stands for First In, First Out. It's the accounting method that determines which buy lots you're selling against when you exit a position.

Say you bought HDFC Bank in two lots:

DateActionQtyPrice
Mar 3Buy100₹1,600
Mar 10Buy100₹1,650
Mar 15Sell100₹1,700

Under FIFO, the March 15 sell matches against the first buy at ₹1,600. Closed P&L = ₹100 × 100 = +₹10,000. You still hold 100 shares at an average cost of ₹1,650.

If the system instead used the second lot (LIFO — Last In, First Out), the closed P&L would be ₹50 × 100 = +₹5,000. Same trades, very different story.

SEBI and Indian tax law require FIFO for equity delivery P&L computation. So your income tax on capital gains uses FIFO — your journaling should too.

Why Zerodha's P&L can differ from FIFO

Zerodha's tradebook shows trade-level data — each buy and sell row. The Console P&L report does apply FIFO for tax purposes, but the raw tradebook CSV doesn't carry lot-matching metadata. If you try to build your own journal from the CSV without re-running FIFO, you'll get incorrect closed P&L for any position you added to or partially exited.

Common scenarios where the mismatch is large:

How Tradrix calculates FIFO P&L from your Zerodha CSV

When you import a Zerodha tradebook CSV into Tradrix, the importer runs a full FIFO matching pass across every symbol:

  1. All buy trades for a symbol are sorted by date (oldest first)
  2. Each sell trade consumes buy lots in order — oldest lot first, partially if needed
  3. Closed trade records are created for each matched lot with the correct cost basis and P&L
  4. Remaining open quantity becomes your current holding with the correct average cost

Re-importing the same file is safe — Tradrix detects duplicates and skips them, so your P&L won't double-count.

Example: partial exit with FIFO in Tradrix

You buy TATA MOTORS 200 shares at ₹800, then add 100 more at ₹840. Later sell 150 shares at ₹870.

Lot matchedBuy priceSell priceQtyP&L
First lot (full)₹800₹870150+₹10,500

Remaining open: 50 shares at ₹800 + 100 shares at ₹840. Tradrix shows both open lots with live unrealized P&L and separate cost bases.

Why this matters for your trading analytics

Accurate FIFO P&L feeds every downstream metric in Tradrix:

FIFO vs LIFO vs Average Cost — which does India use?

For income tax purposes in India, equity delivery trades use FIFO (per SEBI and IT Act requirements). Intraday trades don't carry forward, so lot matching doesn't apply. F&O is treated as business income — but FIFO still gives you the most accurate picture of your trade performance.

Average cost (AVCO) is what most broker dashboards show for unrealized P&L. It's simpler but can mask whether your early lots are profitable while later adds are underwater.

Frequently asked questions

Does FIFO matching work for F&O trades in Tradrix?

Yes. Futures lot matching follows the same FIFO logic. For options, each contract + expiry is treated as a separate symbol, so buy and sell legs are matched independently.

What if I have trades from before I started importing into Tradrix?

You can download your full Zerodha tradebook going back to your account opening date from Console → Reports → Tradebook. Importing the full history gives Tradrix the complete picture for accurate FIFO matching.

How is this different from what Zerodha Console shows for taxes?

Zerodha Console applies FIFO for its tax P&L report, but the data is aggregated by scrip for the full financial year. Tradrix applies FIFO at the trade level so you can see per-trade analytics, setup-level P&L, and open position cost basis in real time — not just at year end.

Import your Zerodha trades — free trial

Related: Zerodha trading journal guide · Trading journal for India · How to calculate real ROI