Get Indian mutual fund NAV in Python
From an API key to a pandas table of NAVs in about ten lines. The examples use the Mutual Fund API and Parag Parikh Flexi Cap Fund (Direct Plan, Growth), scheme code 122639.
Before you start
You need Python 3.9 or newer, the requests and pandas packages, and an API key. Request a free beta key; it arrives by email. Keep the key in an environment variable, not in your code:
pip install requests pandas export EJI_KEY=your-key-here
Fetch the latest NAV and a date range
Every request sends the key in the x-api-key header. A successful response wraps the result in an envelope with status, statusCode, message and data, so the useful part is always data. The script below reads the latest NAV, then pulls a date range from /api/mf/nav-history/scheme-code/{code} and adds the daily percentage change.
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")}
# 1. Latest NAV of one scheme (Parag Parikh Flexi Cap Fund, Direct Growth)
r = requests.get(f"{BASE}/api/mf/scheme-code/122639", headers=HEADERS, timeout=30)
r.raise_for_status()
fund = r.json()["data"]
print(fund["schemeName"], fund["latestNav"], fund["latestNavDate"])
# 2. NAV history for a date range, as a pandas table
r = requests.get(
f"{BASE}/api/mf/nav-history/scheme-code/122639",
params={"start": "2026-10-01", "end": "2026-10-10"},
headers=HEADERS, timeout=30,
)
r.raise_for_status()
df = pd.DataFrame(r.json()["data"])
df["date"] = pd.to_datetime(df["date"])
df = df.set_index("date")
df["daily_change_pct"] = df["nav"].pct_change() * 100
print(df.round(3))Sample output (values change as new NAVs are published):
Parag Parikh Flexi Cap Fund 89.2332 2026-10-30
nav daily_change_pct
date
2026-10-01 88.257 NaN
2026-10-05 88.762 0.572
2026-10-06 88.997 0.265
2026-10-07 88.839 -0.178
2026-10-08 87.656 -1.332
2026-10-09 88.926 1.449Notice there is no NAV for 2 to 4 October: funds publish NAVs only on business days, so the history has gaps on weekends and market holidays. Do not assume one row per calendar day.
Find a scheme code
Use /api/mf/search or look a scheme up by name or ISIN; the search section of the docs lists the parameters. The scheme code is the same one AMFI uses.
Things to know
- Freshness: the service checks AMFI every 6 hours. A scheme's
latestNavDateis the fund's own NAV date and can differ between schemes. - Limits: 120 requests a minute per key, plus a monthly quota. See pricing.
- Errors: check
raise_for_status()and read the error body; see errors. - This is data from public disclosures, not investment advice.