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.
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:
| Date | Action | Qty | Price |
|---|---|---|---|
| Mar 3 | Buy | 100 | ₹1,600 |
| Mar 10 | Buy | 100 | ₹1,650 |
| Mar 15 | Sell | 100 | ₹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.
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:
When you import a Zerodha tradebook CSV into Tradrix, the importer runs a full FIFO matching pass across every symbol:
Re-importing the same file is safe — Tradrix detects duplicates and skips them, so your P&L won't double-count.
You buy TATA MOTORS 200 shares at ₹800, then add 100 more at ₹840. Later sell 150 shares at ₹870.
| Lot matched | Buy price | Sell price | Qty | P&L |
|---|---|---|---|---|
| First lot (full) | ₹800 | ₹870 | 150 | +₹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.
Accurate FIFO P&L feeds every downstream metric in Tradrix:
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.
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.
Related: Zerodha trading journal guide · Trading journal for India · How to calculate real ROI