# Broker export formats — verified column maps Extracted 2026-08-12 from real exports using the project's own `xlsx` module (`XLSX.read(buffer)`), so these layouts are what the parsers will actually see. **Every FILE layout below is VERIFIED against a real file.** Nothing here is inferred from documentation — except the "Native API pulls" section (v4.7.0 C6), which is the brokers' own docs and SDKs only and says so. Where a file carried no data rows, that is stated — the header is still verified, but value-level behaviour is not. Source files live in `tests/fixtures/private/` (gitignored — they carry client codes, PANs and names). This document deliberately contains **no identifiers**. > ⚠️ **The 2026-08-12 samples are schema-only.** Of six files, only one contained a single > data row. They are sufficient to fix detection and column mapping; they are > NOT sufficient to verify that parsed values (prices, P&L, charges) are correct. > > **2026-08-20 — a second batch WITH data** (also in `tests/fixtures/private/`, > redacted schema-only copies in `tests/fixtures/redacted/`): a Paytm Money > tradebook with **414 executions** and its Equity P&L (`.xls`, 3 sheets, 124 > realised lots), a Zerodha Console tradebook with **1,554 fills** and a > Console P&L with 53 rows, and three Upstox reports that were **schema-only** > (that account had no trades). Value-level behaviour was therefore VERIFIED for > Paytm and Zerodha tradebooks and INFERRED for Upstox. > > **2026-09-04 — Upstox is no longer schema-only.** `tests/golden-books.test.ts` > now pins two POPULATED Upstox exports: a realised-P&L export whose single row is > checked against Upstox's own stated figures (gross −1.05, net −4.28, charges > 3.23, met to the paisa by the engine's estimate), and a trade report of 11 > executions → 5 positions committing net −443.14 (a trade report states neither > P&L nor charges, so that one pins our own arithmetic, not the broker's; it was > 4 positions / −271.92 until v4.4.0 verified the F&O grammar and the three option > contracts stopped being priced as NSE cash, and −355.66 until v4.5.0's D2/D3 > corrected Upstox's delivery brokerage and DP charge). Upstox > value behaviour is therefore VERIFIED for the realised-P&L export and pinned for > the trade report; the Upstox ledger has had a parser since v3.9. What the data > changed is recorded per broker below and in DECISIONS.md 2026-08-20. > > **2026-09-18 — the v4.4.0 parser wave** (owner files received 2026-09-16, each > read with the repo's own `xlsx` / `pdf-parse`): the Zerodha Console ledger, the > Groww fund ledger, the Groww and Upstox EQUITY contract notes, and the Upstox > trade report's F&O rows. Each is pinned in `tests/golden-books.test.ts` against > the broker's OWN stated figures (running balance, obligation, net amount) and > has rows in `tests/import-detection-matrix.test.ts`. Sections below. --- ## The detection problem these solve `AGENTS.md` requires: *a broker-named parser must see the broker's NAME before it claims a file*. Filenames are unreliable (Groww's stock order history is called `Stocks_Order_History___.xlsx` and names no broker). So each format needs an **in-content fingerprint**. Every file examined has one: | Format | In-content fingerprint (use this, not the filename) | |---|---| | Zerodha Tradebook | `Auction` column — no other broker emits it. Plus `Trade ID` + `Order ID`. | | Zerodha Console P&L | Charge account heads suffixed `- Z` (`Brokerage - Z`, `Central GST - Z`) | | Zerodha Console tax P&L | `View Zerodha's guide…` preamble line + `Tradewise Exits` table (`Entry Date`/`Exit Date`/`Turnover`/`Profit`) on sheet 0, `- Z` heads on sheet 1 — detection must read ALL sheets | | Paytm Money Tradebook | `UCC` label in A1 + `Script` (sic) + `ETT` column | | Paytm Money P&L | `UCC` in A1 + `Unrealized P/L Summary` / `Realized P/L Summary` | | Angel One Tax P&L | `Angel One Limited` in `Summary!A1` | | Angel One Ledger | `Angelone charge` column in the `Charges` sheet | | Groww Stocks P&L | Sheets named `Trade Level` / `Scrip Level` | | Groww Stocks Order History | `Unique Client Code` header — Groww-specific phrasing | | Upstox trade report / realised P&L | `UPSTOX SECURITIES PRIVATE LIMITED` in A1 (the legal name), header 11 / 22 rows down | | Paytm Money Equity P&L (`.xls`) | section titles `Unrealized P/L Summary (As on …)` / `Realized P/L Summary (From …)` — no parser, mapper | | Angel One Trades_History | NO name anywhere. Sheet `TradesAndCharges` + header with `Scrip/Contract`, `IPFT Charges`, `Order ID`, `Trade ID` together — a FORMAT fingerprint (2026-09-04) | | Dhan P&L (`.xlsx`) | sheet named `Dhan_P&L` + the twelve-column `Scrip Name … Unrealised P&L %` header | | Dhan Realised P&L (`.xls`) | segment-summary header `Segment | Buy Value | … | Net P&L` + the legal name `Raise Securities Private Limited` in the footer (the file never says "Dhan") | | Dhan Ledger (CSV) | header `Posting Date, Posting reference, Description, Narration, Credit, Debit, Net Balance` — `Posting reference` is Dhan's phrasing | | Dhan Dividend payout (CSV) | header `Date, Scrip Name, Dividend Per Share, Quantity, Dividend Paid` under a `Dividend payout report` title | | Zerodha Console ledger (v4.4.0) | cost centre suffixed ` - Z` (`NSE-EQ - Z`) on the entry rows under the `Particulars … Net Balance` header — the same Console suffix as the P&L's charge heads; the header alone claims nothing (real filename `ledger-.xlsx` names no broker) | | Groww fund ledger (v4.4.0) | Segment Type values Groww names after itself (`GROWW_UPI`, `GROWW_WITHDRAW`) under the `Transaction Date … Balance (Rs.)` header, or `Groww` in the filename (`Groww_Balance_Statement_…`) | | Groww contract note, PDF (v4.4.0) | NO page text names Groww (the logo is an image): the legal name sits in the UNCOMPRESSED signature dictionary — `/Name (DS GROWW INVEST TECH PRIVATE LIMITED 1)` — beside `/Reason (Contract-note-verification)`; both halves required | | Upstox contract note, PDF (v4.4.0) | metadata names nobody (`/Title (Contract Note)`, as Dhan's does); `UPSTOX SECURITIES PRIVATE LIMITED` is standard-font `Tj` page text inside a FlateDecode stream, read synchronously by `pdfInflatedText` — plus a contract-note marker | --- ## Zerodha ### Tradebook (XLSX) — per execution Single sheet `Sheet1`, header row 1, data from row 2. ``` Symbol | ISIN | Trade Date | Exchange | Segment | Series | Trade Type | Auction | Quantity | Price | Trade ID | Order ID | Order Execution Time ``` - `Trade Type` is buy/sell. **No charge columns** — charges must come from the Console P&L or a contract note. - **Console export variant (real, 2026-08-20, 1,554 fills):** an 8-row preamble — `Client ID` on row 1, `Tradebook for Equity from to ` on row 5, header on row 9. `Trade Date` is a numeric Excel date serial (renders `2026-04-01`); `Order Execution Time` renders `2026-04-01 11:14:28` — the parser now reads fill TIMES from it. `Series` carries SME series (`SM`, `ST`, `M`, `MT`, `BE`, `B`, `X`, `A`, `T`) besides `EQ`. There is **no Product column** in this export. `Auction` is `false` throughout. Sell-only symbols are common (8 of 23 in the sample — holdings bought before the window), so the tradebook is paired SAME-DAY-FIRST then FIFO (see `lib/import/pair-legs.ts`) and an unmatched sell is an *opening sell* with `basisUnknown`, never a 100% gain. - Sample had `!ref=A1:M3292` but only the header was non-empty: 3,291 formatted blank rows. A row-count check must ignore empty rows or it will claim 3,291 trades. ### Console P&L (XLSX) — aggregated Single sheet. **Data begins at column B** (`!ref=B1:N91`) — a parser assuming column A is off by one. Preamble sections in column B: `Client ID`, `P&L Statement for Equity`, `Summary`, `Charges`, `Other Credit & Debit`, `Realized P&L`, `Unrealized P&L`. Charges block is `Account Head | Amount`. NINE heads carry the `- Z` suffix on the real export (re-verified 2026-08-12 — stronger than first recorded): `Brokerage - Z`, `Exchange Transaction Charges - Z`, `Clearing Charges - Z`, `Central GST - Z`, `State GST - Z`, `Integrated GST - Z`, `Securities Transaction Tax - Z`, `SEBI Turnover Fees - Z`, `Stamp Duty - Z`. The detector requires ≥2 such heads anywhere in the sheet — they sit one per ROW in the charges block, not in the trade-table header. Trade table: ``` Symbol | ISIN | Quantity | Buy Value | Sell Value | Realized P&L | Realized P&L Pct. | Previous Closing Price | Open Quantity | Open Quantity Type | Open Value | Unrealized P&L | Unrealized P&L Pct. ``` **Column-A variant (real, 2026-08-20, 53 rows):** the sheet starts directly at the charges block in column A (8 `- Z` heads — no `Brokerage - Z` — plus `IPFT`), four blank rows, then the trade table with the header on row 14. Three rows carry an ISIN in the `Symbol` cell with an empty ISIN and zero quantity and values (delisted/merged scrips) — skipped, not imported as empty trades. `Open Quantity` / `Unrealized P&L` describe holdings, not trades. ### Console tax P&L (`taxpnl---Q1-Q4.xlsx`) — per EXIT, with full charges **VERIFIED with two real F&O exports (2026-09-01: FY2024-25, 632 rows; FY2025-26, 59 rows).** Two sheets; **data begins at column B** on both. - Sheet 0 `Tradewise Exits from `: preamble (`View Zerodha's guide on using tax reports for filing.` — the in-content broker name — then `Client ID`/`Client Name`/`PAN`, the FY window line), then one or more SECTIONS: a single-cell label row (`F&O`, `Currency`, `Commodity`), its own header row, then data. Sections after the first can be empty (the FY24-25 file carries empty Currency and Commodity sections with bare headers). ``` Symbol | Entry Date | Exit Date | Quantity | Buy Value | Sell Value | Profit | Turnover | Brokerage | Exchange Transaction Charges | IPFT | SEBI Charges | CGST | SGST | IGST | Stamp Duty | STT ``` Entry/Exit are FULL timestamps (`2025-04-02T09:29:49`). Symbols are compact NSE/BSE contract names (`NIFTY2540323750CE`) — see `parseCompactName` in `lib/engine/classify.ts`. `Profit` is GROSS (≡ Sell − Buy); Zerodha's `Turnover` ≡ |Profit| (differences-only basis, NO premium — 6.5–8.7× below the ICAI 11th-ed. figure on the same rows). Zerodha splits one order into a row per execution; the parser groups rows per symbol + entry day + exit day (the tradebook's scrip-day unit) and keeps each row as an execution pair. - Sheet 1 `F&O`: realized-profit + turnover breakdown and a charges block with the `- Z` heads (`IPFT` unsuffixed) — the fingerprint sheet. Reconciliation on the real files: Σ Profit matches the stated realized profit EXACTLY both years; charges match to the paisa on FY25-26, and FY24-25's summary carries ₹187.31 the tradewise rows don't (entry-side charges of positions still open at FY end — the sheet lists exits). - Detection trap this format exposed: the trade table and the fingerprint live on DIFFERENT sheets, so a first-sheet-only `toMatrix` scored it 0 and the file fell to the column mapper. Detection reads all sheets now. ### Console ledger (`ledger-.xlsx`) → `zerodha-ledger` — VERIFIED 2026-09-18 (v4.4.0) Console → Funds → Statement. One real export (6 rows, 2025-06-23 → 2025-07-04); redacted copy `tests/fixtures/redacted/zerodha-ledger-2025-01-01_2026-08-01.xlsx`. Sheet `Equity` (the segment pulled), **data from column B**: `Client ID` on row 7, `Ledger for Equity from to ` on row 11, the header on **row 15** (the owner manifest's "row 4" counts differently — the parser searches for the header): ``` Particulars | Posting Date | Cost Center | Voucher Type | Debit | Credit | Net Balance ``` Then an `Opening Balance` row (Net Balance only), the entries, and a `Closing Balance` row. Posting dates are ISO text; money is NUMERIC to FOUR decimals (a DP charge of `15.045`, a settlement of `23176.1204`). Voucher types seen: `Journal Entry` (DP charges), `Book Voucher` (net settlement per settlement number), `Bank Payments` (the quarterly settlement paid back — its narration says "settlement", so the voucher type is read before the narration). **Pin:** opening 0 + Σ(credit − debit) equals every row's stated Net Balance and the stated closing balance 0.0016, exactly at four decimals. A cash file: it feeds the Cash & Ledger screen and imports no trade. The DB stores whole paise, so a four-decimal entry rounds at that boundary (15.045 → 15.04/15.05). **Fingerprint:** the ` - Z` cost centre (`NSE-EQ - Z`) on at least one entry, or `zerodha`/`kite` in the filename. The embedded `zerodha-logo` picture is not used: SheetJS drops drawings on rewrite, so a redacted copy cannot carry it. --- ## Paytm Money ### Tradebook (XLSX) — per execution, **with full charges** `Sheet1`. Rows 1–4 are metadata (`UCC`, `Name`, `PAN Number`, `Period`). Header on row 5. ``` Date | Script | ISIN | Exchange | Product Type | Type | Quantity | Price | Brokerage | ETT | GST | STT | SEBI | Stamp Duty | Order Number | Trade Number | Trade Time ``` - **The richest tradebook of the three brokers** — per-execution granularity *and* a complete per-trade charge breakdown. Zerodha's tradebook has neither. - Column is `Script`, not `Symbol` or `Scrip`. - **VERIFIED with 414 real executions (2026-08-20, export named `Tradebook_EQ.xlsx`):** - `Script` holds a **numeric scrip code** (six digits; BSE-code-like on BSE rows, Paytm's own id on NSE rows), **not a ticker**. `ISIN` is always filled — Vyuha resolves the symbol from the ISIN at commit (instruments table, then the bundled snapshots) and otherwise keeps the code. - **The code does NOT tell you the exchange, so never resolve by code — resolve by ISIN.** Re-measured on a second real export (7,544 executions, 2026-08-30): 544xxx codes, which look like BSE codes, appear on NSE rows too (e.g. `544838` / XTRANET on NSE), and 30 of 215 distinct codes appear on BOTH exchanges. An ISIN identifies the security regardless of which venue the fill happened on, which is why the lookup is keyed on it. - **Coverage needs BOTH exchanges' lists.** Of that export's 215 distinct codes, the index-constituent map alone resolved 76; of the 139 misses, 69 sat only on BSE rows. The bundled `lib/data/isin-symbols.json` (NSE main + NSE Emerge + BSE, 5,671 securities) resolves all 215. - `Product Type` is `EQ` on every row — the SEGMENT, not delivery/intraday. Product is derived per scrip-day from Paytm's own STT and stamp duty (`lib/import/product-signature.ts`). - STT and stamp duty for a scrip-day are **booked on one execution row** of that day (the last one), not spread per fill — e.g. four buys whose STT reads 0 / 0 / 0 / 1960.08, where 1960.08 = 0.1% of the day's total buy value. Sum per scrip-day before inferring product. - `Trade Time` is empty exactly on the rows whose `Trade Number` is `0` (1,856 of 7,544 in the 2026 export — every one of them), and carries an `HH:MM:SS` clock on the rest (5,688). The 414-row export of 2026-08-20 was ALL trade-number-0 rows, which is why this used to read "empty on every row". `Order Number` is a 16- or 19-digit id. Dates are `dd-mm-yyyy`. - **`Script` switches label mid-window.** The same security appears as a ticker (`HVAX`) in the early months and as a numeric BSE code from July 2026 onward — 35 of the 281 ISINs in the 2026 export were seen under BOTH, and the file is numeric-only from July. Pairing by `Script` split such a security into two books: the ticker's buys were left "open" and the code's sells became "opening sells" with no cost basis. - **Pairing is by ISIN** (2026-09-04): fills group on `ISIN` (plus the stated product), `Script` only when a row has no ISIN. The displayed symbol is the first NON-numeric label seen for that ISIN anywhere in the file, else the code (which commit still resolves via ISIN). ISIN + Exchange was measured and rejected: the same security sold on BSE after being bought on NSE would again be two books (101 opening sells vs 38). The parser reports how many securities it saw under two labels; the import screen repeats it as "N securities appeared under two labels — paired by ISIN". - **Same-day round trips are NOT all intraday.** Of 83 in the 2026 export, 34 are intraday by the charge signature (stamp duty between the two rates) and 49 are genuine CNC delivery — stamp 0.015% on the buy AND STT 0.1% of buy **plus** sell. `corroborate()` therefore uses buy+sell as the delivery STT base for a two-sided row. A scrip-day whose stamp duty sits between the two rates is split by `splitMixedRow` into an intraday pair and a delivery remainder (quantities by the derived fraction, rounded to whole shares; values and charges pro-rata). - The word "Paytm" appears nowhere in the file; the `UCC` label and the `Script` + `ETT` header are the fingerprint, as before. ### P&L (XLSX) — two sections `Sheet1`, `!ref=A2:I73`. Metadata rows, then: `Unrealized P/L Summary (As on …)` ``` Scrip Name | ISIN | Quantity | Buy Average | Buy Value | Closing Price | Present Value | Unrealized P&L | P&L% ``` `Realized P/L Summary` ``` Scrip Name | ISIN | Quantity | Buy Average | Buy Value | Sell Average | Sell Value | Realized P&L ``` Terminated by a `Total` row. ### Equity P&L (`.xls`, 3 sheets) — the download Paytm serves today (real, 2026-08-20) File `_EquityP&L__.xls` (BIFF), sheets `Summary P&L | Realized P&L Detail | Unrealized Transactions`; each sheet has `UCC`/`Name`/`PAN number`/`Period` label rows, dates are `dd-Mon-yyyy`. - `Summary P&L` — the two sections above (`Unrealized P/L Summary (As on …)` with the 9-column header; `Realized P/L Summary (From … – …)` with the 8-column header), each closed by a `Total` row. - `Realized P&L Detail` — **one row per matched lot**: `Scrip Name | ISIN | Quantity | Buy Date | Buy Price | Buy Value | Sell Date | Sell Price | Sell Value | P&L Value`, `Total` row. Lots bought before the period appear with their original buy date. This is the broker-stated reference the tradebook is reconciled against (DECISIONS.md 2026-08-20). - `Unrealized Transactions` — open lots: `Scrip Name | ISIN | Type | Quantity | Date | Price | Value`, `Total` row. Still **no parser** (mapper): the tradebook is the import path; this file is a reconciliation reference. The generic mapper reads the first sheet only. --- ## Angel One ### Tax P&L (XLSX) — 5 sheets `Summary | Equity+Bonds+SGB Trade Details | Derivatives Trade Details | Non Trade Charges | Dividend Report` `Summary!A1` contains `Angel One Limited …` — the fingerprint. **`Equity+Bonds+SGB Trade Details`** — a summary block (rows 0–9), then several independently-headed sub-tables. Each sub-table is preceded by its own title row, so a parser must scan for section titles rather than assume one header: | Section | Columns | |---|---| | `Intraday (Speculation)` | ISIN, Scrip Name, Qty, Transaction Date, Avg Buy Price, Buy Value, Avg Sell Price, Sell Value, Charges and Statutory, STT, Taxable P&L | | `Delivery P&L` | ISIN, Scrip Name, Qty, Buy Date, Sell Date, Avg Buy Price, Buy Value, Avg Sell Price, Sell Value, Cost Of Acquisition, Charges and Statutory, STT, Net Profit/Loss, Long term taxable income, Short term taxable income, Purchase Type, Type of instrument | | `Buyback Transactions` | as Delivery, with Buyback Date / Buyback Price / Buyback Value | | `Transfer Transactions` | as Delivery, with Transfer Date / Transfer Price / Transfer Value | | `Open Sell` | ISIN, Scrip Name, Quantity, Sell Date, Avg Sell Price, Sell Value, Charges and Statutory, STT | | `Open Holdings as of 31…` | ISIN, Scrip Name, Quantity, Avg Buy Price, Buy Value, Charges and Statutory, STT, Closing rate, Turnover, Short term Unrealised P&L, Long term Unrealised P&L | | `Qty Breakup` | ISIN, Scrip Name, Total Qty, **DP Qty, Pool Qty, CUSPA Qty, MTF Qty, Pledge Qty**, Long term quantity, Short term quantity | > `Qty Breakup` carries an explicit **MTF Qty** column. Angel One is the only > examined broker that states MTF quantity directly — Groww's parser has to warn > and ask the user to re-tag. Worth using where available. **`Derivatives Trade Details`** | Section | Columns | |---|---| | `Futures` | Segment, Symbol Name, Expiry date, Qty, Buy Date, Sell date, Avg Buy Price, Buy Value, Avg Sell Price, Sell Value, Total Charges and Statutory, STT, Closing Price(31/03/…) ×2, Taxable P&L, Turnover | | `Options` | Segment, Symbol Name, Expiry date, **Strike Price, Option Type**, Qty, Buy Date, Sell date, Avg Buy Price, Buy Value, Avg Sell Price, Sell Value, Total Charges and Statutory, STT, Taxable P&L, Turnover | **`Non Trade Charges`** → `Charge | Posting Date | Debit Amount | Credit Amount` **`Dividend Report`** → `ISIN | Scrip Name | Dividend Date | Qty | Dividend Rate | Dividend Amount` ### Ledger (`YourStatement_.xlsx`) — 2 sheets `Broking Ledger` → `Transaction | Date | Segment | Voucher | Debit | Credit | Running Balance` `Charges`, day-wise, four independently-headed sections: - DP Charges → `Scrip Name | ISIN | Date | Quantity sold | CDSL charge | Angelone charge | GST | Total charge` - Pledge/Unpledge → as above plus `Pledge/Unpledge | Pledge/Unpledge type` - CUSPA Sell-off → `Scrip Name | Date | Charges levied | GST | Total charge` - Interest → `Type of Interest | Date | Interest applicable amount | Interest charges` ### Tradebook (`Trades_History_.xlsx`) — per execution, **with per-row charges** (real, 2026-09-04) One sheet, `TradesAndCharges`. The word "Angel" appears nowhere — not in the filename, not in a cell — so this is the one Angel layout claimed on a FORMAT fingerprint: the sheet name together with `Scrip/Contract`, `IPFT Charges`, `Order ID` and `Trade ID` in the header. Rows 1–31 are a label/value preamble (`ClientCode`, `DateOfDownload`, `StartDate`/`EndDate`, a `Charges Summary` — `Total Trades`, `Total Charges`, `Total Trade Charges`, `Total Non Trade Charges`, then each trade head and each non-trade head); the table titled `TradeBook And Charges` starts at row 34: `Scrip/Contract | Buy/Sell | Buy Price | Sell Price | Quantity | Brokerage | GST | STT | Sebi Tax | Exchange Turnover Charges | Stamp Duty | Other Charges | IPFT Charges | Order Type | Segment | Exchange | Order ID | Trade ID | Date` What the parser does with it: `Order Type` (Intraday / Delivery) is the product; `Segment` is `CAPITAL` or `FUTURES` × `Exchange` NSE/BSE; the price sits in `Buy Price` or `Sell Price` by side; `Date` is an Excel date with no clock (it renders `8/27/26 0:00` — m/d/yy — so it is read US-order, and no fill time is invented). Charges are the broker's stated per-row figures and are stored as such. **Rows with quantity 0 and no Trade ID are the flat per-order F&O brokerage lines** (₹20 + GST): they are summed into their contract's charges and never into its quantity — which is why the real file's 24 rows are 17 `Total Trades`. F&O contracts come as `OPTSTK ICICIBANK Sep 29 2026 1550.00 CE (BT)` / `BSXOPT SENSEX …` / `OPTIDX NIFTY …` and are rewritten to the classifier's `OPT
`. The file's own `Total Charges` includes non-trade charges (DP, AMC); `Total Trade Charges` is the figure the rows sum to (verified: 157.79 of 252.19). **The Zerodha misclaim this exposed.** `detectZerodha` awarded its tradebook score to any header carrying `Trade ID` + `Order ID`, and claimed this file at 0.50 while the Angel parser scored 0. The pair now needs something Zerodha actually writes — the `Auction` column, `Order Execution Time`, the "Tradebook for Equity from …" preamble, or a name — before it counts. --- ## Upstox Three real exports examined 2026-08-20 were **all schema-only** (that account had no trades). A fourth and fifth, examined 2026-09-04, are POPULATED and pinned by `tests/golden-books.test.ts` — a realised-P&L export checked against Upstox's own stated figures (gross −1.05, net −4.28, charges 3.23, met to the paisa) and a trade report of 11 executions → 5 positions committing net −443.14 (4 positions / −271.92 until v4.4.0 — see the F&O grammar below; −355.66 until v4.5.0's D2/D3 repriced the two equity round trips at min(₹20, 2.5%) brokerage and a ₹20 DP charge). So the layouts below are VERIFIED, and value behaviour is VERIFIED for the realised-P&L export and pinned (against our own arithmetic, not a broker statement) for the trade report; the ledger parser shipped in v3.9 (`upstox-ledger`); the F&O tradingsymbol grammar is VERIFIED 2026-09-18 from the 2026-09-16 trade report (six option rows, below), and the EQUITY contract note has a parser as of v4.4.0 (below). Filenames name no broker: `trade___.xlsx`, `realizedPnL_EQ__To__.xlsx`, `ledger__To__trading_.xlsx`. **Fingerprint: `UPSTOX SECURITIES PRIVATE LIMITED` in A1** (then `(Formerly …)`, `Dealing Office …`, `UCC`/`Name`/… label rows, `Report Time Period`, `Generated On`). Every sheet ends with a footer note (`From 19-Jul-2025, our Broking …`). ### Trade report — sheet `TRADE`, header on row 11 ``` Date | Company | Amount | Exchange | Segment | Scrip Code | Instrument Type | Strike Price | Expiry | Trade Num | Trade Time | Side | Quantity | Price ``` `Company` is the name column (used as the symbol); `Trade Time` is a separate time column; `Instrument Type` / `Strike Price` / `Expiry` carry F&O. No product column. **F&O grammar — VERIFIED 2026-09-18** against a populated report (11 executions, 6 of them F&O; the 2026-09-16 re-download carries the same 11 rows as the committed `upstox-trade-2026-08-28_2026-09-04.xlsx`). An F&O row reads: `Company` = the underlying as Upstox codes it (`NIFTY`; `BSX` for SENSEX — BSE's own contract code), `Exchange` = `FON` (NSE F&O) or `FOB` (BSE F&O), `Segment` = `FO`, `Instrument Type` = `European Put` / `European Call`, `Strike Price` a plain number (`24000`, `78300`), `Expiry` `dd-mm-yyyy` text, day-first like `Date` (01-09-2026 is a Tuesday, NIFTY's expiry; 03-09-2026 a Thursday, SENSEX's). `upstoxOptionContract` (`lib/import/parsers/angelone-upstox.ts`) turns such a row into the canonical name every other broker's options land as — `OPT NIFTY 01 Sep 2026 24000 PE`, `OPT SENSEX 03 Sep 2026 78300 CE` — BEFORE grouping, so a PE and a CE on one underlying are two positions. Anything outside that grammar (a future, an American option, a blank/zero strike, a non-`dd-mm-yyyy` expiry, an expiry before the trade date) keeps its row flagged, never guessed. Pinned in `tests/golden-books.test.ts` (three contracts, classify → `index_option`, and per-position charges). Measured against Upstox's own ledger for the same day: its F&O bill (354.57) carries 226.57 of charges where our rate card computes 156.76 — see that describe; a rate-card question, not a grammar one. ### Realised P&L — sheet `REALIZED_PNL`, header on row 22 Preceded by `Segment | EQ`, a `P&L Summary` block (`Gross P&L`, `Net P&L`) and a `Charges` block (`TOTAL`), then `Realised P&L Details`: ``` Scrip Name | Scrip Code | Symbol | ISIN | Scrip Opt | Qty | Buy Date | Buy Rate | Buy Amt | Sell Date | Sell Rate | Sell Amt | Days | Total PL | Short Term | Long Term | Speculation | Turn Over ``` `Speculation` ≠ 0 → intraday; `Short Term`/`Long Term` ≠ 0 → delivery (derived). ### Ledger — sheet `LEDGER_V3` The schema-only sample carries `Wallet | TRADING` and **no column header at all** — nothing to map, so no parser claims THAT copy, by design. A populated export does have the header row and is read by `upstox-ledger` (below). ### Contract note cum tax invoice, EQUITY (PDF) → `upstox-contract-note` — VERIFIED 2026-09-18 (v4.4.0) `CW_T____.pdf`, 3 pages, unprotected. One real note (NSE-EQ, 28-08-2026, 2 fills — the PRECISIO WIR round trip); the committed fixture is its `pdf-parse` TEXT with identity tokenised (`tests/fixtures/redacted/upstox-contract-note-2026-08-28.txt`, made by `scripts/fixtures/redact-contract-note.mjs`; the note number recurs as the GST invoice number `NSE/` and is zeroed in both places). Annexure A, one line per fill: `