← All posts

By , fintech product manager at Keep Technologies · · Updated

I built a free API for Pakistani mutual fund NAVs (because MUFAP's own one doesn't work)

A free API for Pakistani mutual fund NAVs

Why MUFAP's own API doesn't work

I needed daily NAV (net asset value) data for every Pakistani mutual fund for Gramafin, the personal finance app I've been building. The obvious place to get it is MUFAP, the Mutual Funds Association of Pakistan, the industry body that every asset management company reports to. They even have what looks like a JSON API behind their fund directory page.

It doesn't work. Or rather, it doesn't work for anyone who isn't a browser. I tried hitting their endpoints with headers copied byte-for-byte from a real Chrome request (same User-Agent, same Accept headers, same everything) and got a 500 every time. My best guess is there's some session or anti-forgery token their own frontend JS sets up that isn't practical to replicate from a plain server-side request. I didn't chase it further than that.

Their public Fund Directory page does work, though. It's a plain, server-rendered HTML table: every one of MUFAP's 500+ funds, with current NAV and offer price sitting right there in the markup. No auth wall, no pagination, no JavaScript required to see it. So instead of fighting their broken API, I scrape the page that already has the data.

To be fair, there is a paid option

I should be clear that this isn't a total void. CapitalStake sells a Pakistani mutual funds data product, and it's substantially more comprehensive than what I built: AUMs, AMC breakdowns, sector allocations, top and quarterly holdings, payouts and full NAV history, delivered over REST, WebSocket, CSV or Excel, with an uptime SLA behind it.

It's also a commercial product with a "request a consultation" button where the pricing usually goes. That's a perfectly reasonable business. Maintaining that depth of data costs real money, and if you need holdings history, sector allocation and a 99.99% uptime guarantee, you should go and pay them for it. I'm not pretending this repo competes with that.

But most of the time you don't need any of that. You need today's NAV for 531 funds, as JSON, without a sales call or a recurring invoice. That's the gap this fills. And because it's MIT-licensed, the next person with the same narrow need doesn't have to rebuild it, or budget for it, either.

Turning it into its own thing

This started as a small piece of Gramafin's backend: a scraper, a Redis cache, a cron job. But scraping MUFAP isn't really a Gramafin-specific problem. Anyone building anything in the Pakistani fintech space, a budgeting app, a robo-advisor, a research tool, runs into the exact same wall. So I pulled the logic out into its own thing: pakistan-mutual-funds-api, free and open source on GitHub.

The pakistan-mutual-funds-api repository on GitHub

It's deliberately boring technology: no database to set up, no cloud account to configure, no framework to learn. Clone it, npm install, run it. That's the whole ask.

What it actually does

Three small pieces, each doing one thing:

  • Scrapes MUFAP's Fund Directory with cheerio, pulling fund name, AMC, NAV, offer price and category for every fund listed.
  • Stores the result as a plain JSON file on disk. No Postgres, no Redis, no ceremony. If you can read a JSON file, you can run this.
  • Serves it over a small Express API, GET /api/funds, CORS wide open so you can call it straight from frontend JS.

The only configuration that actually matters is how often it re-scrapes. MUFAP publishes updated NAVs once per business day (they don't move intraday), so the default is once a day, skipping weekends. You can dial that up or down with one environment variable, or turn the built-in scheduler off entirely and trigger scrapes from your own cron if you're deploying this somewhere serverless.

Here's what a real response looks like (this is live data, not a mockup):

A real response from GET /api/funds showing live NAV data for Pakistani mutual funds

Try it

bash
git clone https://github.com/saadsalmankhan/pakistan-mutual-funds-api.git
cd pakistan-mutual-funds-api
npm install
cp .env.example .env
npm run dev

That's it. It scrapes once on startup and starts serving at localhost:4000/api/funds. Full config options and API reference are in the README.

If you build something with it, or run into MUFAP changing their page markup and breaking the scraper (it'll happen eventually), open an issue. It's MIT-licensed: use it, fork it, fix it.

Update (August 2026): it's a dataset now, not just an API

Since publishing this, the project grew the pieces people kept asking for.

NAV history. Every scrape now appends each fund's NAV to a per-fund NDJSON file, so any instance builds its own time series from the day it starts running. New endpoint: GET /api/funds/:id/history, with from and to date bounds.

Lookups and filters. GET /api/funds/:id for a single fund, plus category, AMC, name search and shariah=true filters on the list endpoint, and /api/categories and /api/amcs for building dropdowns.

Shariah flags, benchmarks and expense ratios. Every fund now carries a shariah boolean (295 of 549 funds are Shariah-compliant, derived from MUFAP's own category names) and a benchmark mapping: KSE-100 for conventional equity categories, KMI-30 for Shariah equity, null where no single index honestly applies. A separate npm run enrich pulls each fund's total expense ratio, management fee and inception date from MUFAP's expense ratios table and merges them into the snapshot.

A public dataset that updates itself. If you don't want to run anything at all: pakistan-mutual-funds-data is a repo where a GitHub Action scrapes MUFAP every business day and commits the snapshot, the growing NAV history and the fund metadata. You can curl the raw files and be done, and the commit log doubles as an audit trail of every data change. And it comes pre-loaded: I backfilled daily NAV history to January 2022, so it starts at 432,000 entries across 554 funds instead of starting empty.

Why this matters: a team building an AI mutual funds advisor wrote about their AWS hackathon project that no clean, structured, public dataset existed for Pakistani mutual funds, and they had to assemble 301,749 NAV rows by hand before they could build anything. That dataset now exists, it updates itself daily and it's free.

If you build something with it, I'd genuinely like to hear about it.

Was this useful?
Saad Salman, fintech product manager

Written by

Saad Salman

Fintech product manager in Lahore. I lead program management at Keep Technologies, where I launched the corporate card program with Mastercard, PTC and i2c, and I've shipped 20+ financial products across Canada, the UK, the EU and MENAP. I also consult on card programs. More about me.

Share this post

Get new posts by email

Occasional writing on payments, fintech and building products. No spam, unsubscribe anytime.

1 comment

  • E
    Eagle18d ago

    Thank you for your contributions!

Leave a comment

Be kind. Comments appear right away.