Case study

Mutual Fund Backtest

What would your portfolio have returned? Ask the published NAVs.

The challenge

Fund returns in India are usually quoted one scheme at a time, over whichever period flatters the pitch. What an investor actually holds is a portfolio — several funds, in specific proportions — and the honest questions are portfolio-level: what would this mix have returned as a lumpsum or a monthly SIP, and how did it behave from every start date, not just a chosen one? Answering that takes NAV-level math over a decade of daily data — and the few free tools that attempt it lean on a single unofficial API that can throttle or vanish at any time.

The approach (built with Claude Code)

Enable built a full backtesting engine inside mutualfundoverlap.in — deep enough to stand as its own product. Up to five portfolios of ten funds each, with the allocation weights an investor would actually use; lumpsum and SIP modes (SIP returns computed as XIRR, the money-weighted standard); and rolling returns that re-run each 1/3/5-year window from the start of every month, so a result can't hide behind a lucky start date. The benchmark is a Nifty 50 index fund's NAV — dividend-reinvested, so it proxies the index's total return, and every label says “proxy” rather than claiming TRI outright. The tool is strictly educational: every figure is history, never a forecast, and an “honest N/A” rule means a portfolio that can't be fully priced shows N/A with a reason instead of silently re-weighting the surviving funds.

What we shipped

A free public tool at mutualfundoverlap.in/backtest, plus the data infrastructure under it: a nightly pipeline that appends AMFI's official published NAVs into the site's own store — full history for 3,577 schemes, refreshed by ~02:30 IST — so no user request depends on a third-party API. Results render as server-generated SVG charts (no client charting library to download), and a diversification check reuses the platform's holdings-overlap engine so returns and portfolio concentration are read together. The module ships with 230 automated checks across engine math, golden-fixture results, the NAV store, and compliance copy.

Outcome

Live and free, with the nightly NAV pipeline in unattended production since 31 July 2026. Usage and traffic figures aren't published here until the client supplies verified data — the same rule as every case study on this site.

Screenshots

  • Rolling one-year returns chart plotting two portfolios and the Nifty 50 benchmark from every monthly start date since 2014, with worst, median, and best windows tabulated
  • Backtest tool landing view showing the past-performance-only disclosure and the NAV and holdings freshness dates in the header
  • Mutual Fund Backtest desktop view with the portfolio builder and results comparing two portfolios against a Nifty 50 index-fund benchmark
  • Mutual Fund Backtest lumpsum results table on a mobile viewport

Tech notes

Python/Flask engine (stdlib date + XIRR math), AMFI NAV store as gzipped JSON on GitHub Releases (nightly GitHub Action), server-rendered SVG rolling-return charts, Cloudflare Worker routing, Railway deploy.