Long-term portfolios need transaction-level calculations that simple holding summaries cannot provide. PortFin preserves lots and sell history so realized gains, remaining cost basis, XIRR, holding periods, and estimated LTCG or STCG treatment can be analysed consistently across the portfolio.
PortFin - Database portfolio dashboard
A full-stack Indian investment dashboard for trades, holdings, FIFO profit and loss, live prices, benchmarks, goals, tax estimates, and portfolio planning.
About PortFin - Database portfolio dashboard
This full-stack PortFin build stores Indian equity, ETF, and mutual-fund instruments and trades in PostgreSQL. It separates realized and unrealized performance, applies FIFO lot matching to sales, refreshes market prices, saves portfolio snapshots, and connects analytics with goals, benchmarks, estimated taxes, and rebalancing tools.
Product thinking
Challenge and approach
Every sell consumes the oldest available lots first and records matched holding periods for estimated tax classification. XIRR uses a Newton-Raphson solver, while weighted CAGR, portfolio snapshots, and indexed benchmark series support longer-term performance analysis.
Capabilities
Main features
Trade, instrument, holding, and snapshot management
FIFO sell matching with separate realized and unrealized profit and loss
Portfolio-wide and lot-level XIRR, CAGR, tax, and holding-period analytics
Benchmark comparison, alpha tracking, loss harvesting, and sector analysis
Goal planner, SIP projections, rebalancer, and wealth waterfall
Optional local Ollama portfolio advisor with streaming responses
Architecture
How the system is structured
- 01
Next.js App Router pages and API routes provide the portfolio interface and server-side endpoints.
- 02
PostgreSQL and Prisma model users, portfolios, instruments, trades, and point-in-time snapshots.
- 03
The portfolio engine centralizes FIFO matching, XIRR, CAGR, estimated tax, and formatting rules.
- 04
React context coordinates portfolio loading, state, and actions across dedicated dashboard views.
Implementation
Technology and data
Technology stack
- Next.js
- React
- PostgreSQL
- Prisma
- Tailwind CSS
- Chart.js
- Ollama
- Server-Sent Events
Data sources
- Yahoo Finance stock and ETF prices
- AMFI mutual-fund NAV data
- NSE and BSE instrument files
- User-entered portfolio trades
Engineering details
Technical considerations
PrivacyData and privacy
- The optional AI advisor runs through a locally configured Ollama instance and requires no third-party AI API key.
- Portfolio records are stored in the configured PostgreSQL database rather than embedded in page code.
Current scopeKnown limitations
- Tax calculations are estimates and are not a substitute for advice from a chartered accountant.
- The Nifty 50 comparison includes approximate hardcoded month-end values through April 2026 rather than a complete live benchmark feed.
- Some analytics benchmark CAGR figures are dated and can diverge from current values.
- AI responses are informational; PortFin is not a SEBI-registered investment adviser.
OperationsDeployment considerations
- A PostgreSQL connection and generated Prisma client are required.
- Yahoo Finance stock and ETF prices use a six-hour cache; AMFI NAV refresh is explicit.
- The Ollama advisor is optional and requires a locally available model server.
- The seed workflow clears and reimports trades, so it is intended for controlled setup data.
Use cases
What the project supports
- Maintain an Indian equity, ETF, and mutual-fund transaction ledger
- Analyse realized and unrealized performance with FIFO lot matching
- Compare portfolio results with Indian market benchmarks
- Plan goals, estimated taxes, loss harvesting, and rebalancing actions