Corporate Actions and the Backfill Pipeline

Part of the Sanchayam series. The Problem When an Indian equity undergoes a 2-for-1 stock split, a holding that showed 100 shares should now show 200 shares at half the price. The historical lot prices need to be adjusted retroactively - otherwise the cost basis and XIRR calculations are wrong. Similarly, when a company changes its name or trading symbol (Infosys was previously INFOSYSTCH, Hindustan Unilever was Hindustan Lever), historical price data retrieved by the current symbol will not cover periods before the name change. ...

May 20, 2026 · 5 min · 865 words · Sagar Nayak

Friday Snapshots: Weekly Portfolio and Historical Backfill

Part of the Sanchayam series. Why Friday Portfolio performance is tracked week by week, not day by day. Daily snapshots would generate a large amount of data for a view that is displayed weekly at best. Friday is chosen because Indian markets close at 3:30 PM IST on Friday. The snapshot cron runs at 11:00 AM UTC, which is 4:30 PM IST - 30 minutes after market close, giving price feeds time to settle. ...

May 14, 2026 · 4 min · 811 words · Sagar Nayak

XIRR from Scratch: Newton-Raphson on a Portfolio

Part of the Sanchayam series. What XIRR Is XIRR (extended internal rate of return) is an annualized return that accounts for the timing of cash flows. Simple absolute return tells you what percentage you gained on an investment. XIRR tells you what annual rate of return is equivalent to the actual cash flows you made - buys, sells, and the current value - given exactly when each one happened. A 50% gain over 10 years is very different from a 50% gain over 2 years. XIRR captures that difference. It is the standard metric for evaluating the performance of an investment portfolio with irregular cash flows over time. ...

May 8, 2026 · 5 min · 1040 words · Sagar Nayak

FIFO Cost Basis and Realized P&L

Part of the Sanchayam series. Why FIFO FIFO (first in, first out) is the standard cost basis method for Indian equities and mutual funds for tax purposes. When you sell shares, the oldest lots you bought are assumed to be the ones sold first. The cost basis of those oldest lots determines your taxable gain. Sanchayam implements FIFO at sell time: when a sell lot is recorded, the backend walks the buy lots in chronological order, consuming them until the sell quantity is satisfied, and computes the aggregate cost. ...

May 2, 2026 · 4 min · 678 words · Sagar Nayak

The Asset Schema: One Table for Every Asset Type

Part of the Sanchayam series. The Problem with Per-Type Tables The obvious design for a multi-asset tracker is a table per asset type: one for stocks, one for mutual funds, one for real estate. That approach breaks down when you need cross-asset aggregation. Computing total portfolio value means querying five different tables and unioning them. Adding a new asset type means new tables, new routes, new UI components. Sanchayam uses a single assets catalog and a single holdings table. Behavior differences between asset types are encoded in schema flags, not in separate tables. ...

April 8, 2026 · 4 min · 841 words · Sagar Nayak