Skip to main content

Async-first Python library for Mutual Fund data and analytics

Project description

Fundkit

A modern, async-first Python library for Mutual Fund data, analytics, and portfolio management.

Built on top of AMFI's public data with a typed, developer-friendly API - no third-party data vendors, no black-box calculations.

from fundkit import NAVClient
import asyncio

async def main():
    async with NAVClient() as client:
        data = await client.get_nav(123456)
        print(data)

asyncio.run(main())

Installation

pip install fundkit

OR

uv add fundkit

Current Status

Fundkit is under active development. The data/ layer is complete. schema/, portfolio/, analytics/, tax/, sip/, compare/ ... modules are in progress.

Usage

Latest NAV data

from fundkit import NAVClient
import asyncio


async def main():

    async with NAVClient(verbose=True) as client:  # verbose = TRUE for logging (defaults to False)
        # ----------- Fetch NAV data for a single scheme ----------
        nav = await client.get_nav(128628)
        print("Single Scheme NAV Data")
        print(f"Scheme Code           : {nav['scheme_code'].item()}")
        print(f"ISIN (Growth/Payout)  : {nav['isin_growth_or_payout'].item()}")
        print(f"ISIN (Div Reinvest)   : {nav['isin_div_reinvestment'].item()}")
        print(f"Scheme Name           : {nav['scheme_name'].item()}")
        print(f"NAV                   : {nav['nav'].item()}")
        print(f"Date                  : {nav['date'].item()}")
        print(f"AMC                   : {nav['amc'].item()}")
        print(f"Scheme Type           : {nav['scheme_type'].item()}")
        print()

        # ------------ Fetch NAV data for multiple schemes ---------
        df = await client.get_nav([119597, 120505, 108272])
        print(df)

        # ------------ Fetch NAV data by scheme name ---------------
        results = await client.get_nav_by_name("bluechip", case_sensitive=False)

        # ------------ Fetch NAV data by AMC -----------------------
        results = await client.get_nav_by_amc("SBI")

        # ------------ Fetch NAV data by Fund type -----------------
        results = await client.get_nav_by_type("Open Ended Schemes")
        print(results)

        # ------------ Validate scheme code -----------------------
        is_valid = await client.is_valid_scheme_code(119597)
        print(is_valid)

        # ------------ Force refresh the disk-cache ----------------
        await client.refresh_nav_cache()


asyncio.run(main())

Historical NAV data

from fundkit import HistoricalNAVClient
import asyncio
from datetime import date


async def main():
    # ------------ Fetch historical NAV data with start-date, end-date default to today ----------------
    async with HistoricalNAVClient(verbose=True) as client:
        data = await client.get_history(124182, start_date=date(2026, 1, 1))
        print(data)

    # ------------ Fetch historical NAV data with start-date and end-date ----------------
    async with HistoricalNAVClient(verbose=True) as client:
        data = await client.get_history(124182, start_date=date(2025, 1, 1), end_date=date(2026, 3, 31))
        print(data)

    # ------------ Output as pandas dataframe (defaults to polars) ----------------
    async with HistoricalNAVClient(verbose=True) as client:
        data = await client.get_history(124182, start_date=date(2025, 1, 1), df_format="pandas")
        print(data)


asyncio.run(main())

Output formats

All bulk methods support output in both polars (default) and pandas:

df = await client.get_nav([119597, 120505], fmt="pandas")

Caching

Fundkit caches data locally to avoid unnecessary network calls.

Cache is stored using platformdirs — on Linux ~/.cache/fundkit/, on macOS ~/Library/Caches/fundkit/, on Windows %LOCALAPPDATA%\fundkit\.

The table below shows the data for Linux.

Cache Location (Platform Native) TTL Current
NAV ~/.cache/fundkit/nav.parquet 24 hours
Historical NAV ~/.cache/fundkit/historical/{scheme_code}.parquet Permanent (immutable past data)
Fund house IDs ~/.cache/fundkit/mf_id_map.json 7 days

Caching Hierarchy

Why Fundkit

Most existing Python tools for mutual funds either wrap third-party APIs (mfapi.in, mftool), are synchronous-only, return untyped raw dicts, or have no concept of SIPs, switches, or tax computation.

Fundkit is built differently:

  • Async-first: Built on httpx and asyncio, usable in FastAPI, Django async views, or any modern async app.

  • Typed everywhere: Pydantic v2 models for all domain objects, polars DataFrames with proper schemas for bulk data.

  • AMFI-native: Hits AMFI directly, no middlemen that can go down.

  • Polars-first: 10–100x faster than pandas for bulk NAV operations, with optional pandas export.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fundkit-0.1.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fundkit-0.1.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file fundkit-0.1.1.tar.gz.

File metadata

  • Download URL: fundkit-0.1.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fundkit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cacbe7695a46fed6c09ff1ae6fa711ed3a1ded8bbfb086504036bef88878addc
MD5 ea9044dbe718e2289b56ee8ea5b24ddf
BLAKE2b-256 80e2976d97c56b36715cf3e8adc8b46d99b52b69d6d789c433e9c1641b013267

See more details on using hashes here.

File details

Details for the file fundkit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fundkit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fundkit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e6f54f6d700a9ff78a75d5d43db80656b84b651566220b41066fc7728e8bfbf
MD5 e070b6b416066e14f9a87ae8d0f90865
BLAKE2b-256 03048eaf0fdda43a47c933cd7012d33ab6c247fdf6b8979cab66a6d7a982b3fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page