Download a mutual fund's full NAV history

The history endpoint returns every stored NAV, oldest first. This guide fetches it by scheme code and by ISIN, turns it into month-end figures and a year-on-year growth series, and saves a CSV. It continues from Get mutual fund NAV in Python.

The endpoints

GET /api/mf/nav-history/scheme-code/{code}?start=YYYY-MM-DD&end=YYYY-MM-DD
GET /api/mf/nav-history/isin/{isin}?start=&end=

start and end are optional ISO dates. Leave both out for the whole history. Each item is {"date": "2026-10-26", "nav": 89.3}. See the reference.

Full history, month-end series and CSV

Requires pandas 2.2 or newer for the "ME" (month-end) frequency; on older versions use "M".

import os
import requests
import pandas as pd

BASE = os.environ.get("EJI_BASE", "https://fin.ejiapi.com")
HEADERS = {"x-api-key": os.environ.get("EJI_KEY", "YOUR_KEY")}

# Full history: leave start and end out
r = requests.get(f"{BASE}/api/mf/nav-history/scheme-code/122639", headers=HEADERS, timeout=60)
r.raise_for_status()
df = pd.DataFrame(r.json()["data"])
df["date"] = pd.to_datetime(df["date"])
df = df.set_index("date")["nav"]
print(len(df), "rows from", df.index[0].date(), "to", df.index[-1].date())

# Same history by ISIN
r2 = requests.get(f"{BASE}/api/mf/nav-history/isin/INF879O01027",
                  params={"start": "2026-10-01", "end": "2026-10-10"}, headers=HEADERS, timeout=30)
print(r2.status_code, r2.json()["data"][:2])

# Month-end NAV and year-on-year growth
month_end = df.resample("ME").last()
print(month_end.tail(3))
print((month_end.pct_change(12) * 100).dropna().tail(3).round(2))

# Save to CSV
df.to_csv("nav_122639.csv", header=True)

# A missing scheme: what the error looks like
bad = requests.get(f"{BASE}/api/mf/scheme-code/0", headers=HEADERS, timeout=30)
print(bad.status_code, bad.json())

Sample output:

3293 rows from 2013-05-28 to 2026-10-30
200 [{'date': '2026-10-01', 'nav': 88.2569}, {'date': '2026-10-05', 'nav': 88.762}]
date
2026-08-31    90.7827
2026-09-30    88.8355
2026-10-31    89.2332
Freq: ME, Name: nav, dtype: float64
date
2026-08-31   -0.32
2026-09-30   -3.54
2026-10-31   -5.48
Freq: ME, Name: nav, dtype: float64
404 {'title': 'Scheme not found', 'status': 404, 'detail': 'Scheme not found', 'instance': '/api/mf/scheme-code/0'}

The last two lines show how an unknown scheme fails: HTTP 404 with a JSON problem body. Always check the status before reading data.

Notes on the numbers

Get a free API key Read the API reference