Skip to main content

Async-first Python library for Mutual Fund data and analytics

Project description

FundKit

A modern, async-first Python library for Indian mutual fund data. FundKit fetches NAV and scheme information directly from AMFI - no third-party data vendors, no opaque middle layers.

If you're building dashboards, research pipelines, or backend services that need reliable fund data, FundKit gives you typed DataFrames with sensible caching out of the box.

import asyncio
from fundkit import NAVClient

async def main():
    async with NAVClient() as client:
        nav = await client.get_nav(128628)
        print(nav)

asyncio.run(main())

Installation

pip install fundkit
# or
uv add fundkit

Optional pandas support:

pip install fundkit[pandas]

What's available

The data module is ready to use today. The schema module provides typed Pydantic models for structured responses. Planned modules - portfolio, analytics, tax, sip, compare, and more - are still in progress.

Client Purpose
NAVClient Today's NAV - lookup by scheme code, name, AMC, or fund type
HistoricalNAVClient NAV history for a date range
SchemeDetailsClient Scheme metadata - category, launch date, minimum investment, and more

All clients return Polars DataFrames by default (except SchemeDetailsClient.get_scheme_details, which returns a typed SchemeDetails model). Pass df_format="pandas" if you prefer pandas. They also share helper methods for scheme validation and discovery - see the data module docs for the full list.

Usage

import asyncio
from datetime import date
from fundkit import NAVClient, HistoricalNAVClient, SchemeDetailsClient

async def main():
    async with NAVClient(verbose=True) as client:
        # Single or multiple scheme codes
        nav = await client.get_nav(128628)
        batch = await client.get_nav([119597, 120505, 108272])

        # Search by name, AMC, or fund type
        by_name = await client.get_nav_by_name("bluechip", case_sensitive=False)
        by_amc = await client.get_nav_by_amc("SBI")
        by_type = await client.get_nav_by_type("Open Ended Schemes")

        # Utilities
        valid = await client.is_valid_scheme_code(119597)
        schemes = await client.get_scheme_codes(query="bluechip", by="scheme_name")
        amcs = await client.get_amc_list()

    async with HistoricalNAVClient(verbose=True) as client:
        history = await client.get_history(
            124182,
            start_date=date(2023, 1, 1),
            end_date=date.today(),
            df_format="pandas",  # optional - defaults to polars
        )

    async with SchemeDetailsClient(verbose=True) as client:
        details = await client.get_scheme_details(128628)
        bulk = await client.get_scheme_details_bulk([128628, 119597])

asyncio.run(main())

Set verbose=True on any client to print cache hits, fetches, and other log messages to the console.

For architecture, caching details, output schemas, and a full method reference, see src/fundkit/data/README.md.

How FundKit compares

Most Python libraries in this space follow a similar pattern: a synchronous class that wraps a third-party API (like mfapi.in), returns dicts or pandas DataFrames, and re-fetches on every call.

That works fine for one-off scripts, but it gets painful in async web apps or when you're filtering thousands of schemes repeatedly.

FundKit takes a different approach:

Typical MF data libraries FundKit
Data source Third-party API proxy AMFI directly
Execution model Synchronous (requests) Async-first (httpx + asyncio)
Default output Dict / JSON / pandas Typed Polars DataFrame
Bulk filtering Load everything, filter in Python Vectorized Polars operations
Caching None or in-memory only Memory -> disk (parquet) -> network
Typed schemas Untyped dicts Consistent column names and dtypes

FundKit doesn't try to replace every feature these libraries offer (daily performance metrics, JSON export, MCP servers, etc.) - at least not yet. The focus right now is a solid, fast, cache-aware data layer you can build on top of.

Caching

FundKit caches data locally so repeated calls in the same day don't hammer AMFI.

Cache location is platform native:

Platform Path
Linux ~/.cache/fundkit/
macOS ~/Library/Caches/fundkit/
Windows %LOCALAPPDATA%\fundkit\
Data TTL
Latest NAV Same calendar day (memory + disk)
Historical NAV Permanent, append-only per AMC
Scheme details 7 days (memory + disk)

Historical data is never re-fetched once cached - past NAV is immutable. Latest NAV refreshes automatically when the calendar day changes.

Why FundKit

  • Async-first - built on httpx and asyncio; fits naturally into FastAPI, Django async views, or any modern async stack
  • AMFI-native - one less dependency that can go down or change its API without warning
  • Polars-first - filtering ~15k schemes is significantly faster than row-by-row Python; pandas export is one argument away
  • Typed and structured - consistent column names (scheme_code, nav, date, …) whether you're querying one scheme or ten thousand

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.3.tar.gz (17.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.3-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fundkit-0.1.3.tar.gz
Algorithm Hash digest
SHA256 53c5aa4ac07654b97851502c6bed2849f3acce238db0aac49f21d3aa2b50dbf3
MD5 125406cd4a6502b0aa8cfd9107348350
BLAKE2b-256 26530e282cb9e75f87d533e54ae061112fb22137570394734d1f7665e50042a0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fundkit-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bf57752236436cc4a8fc0714e58b1f891c68c34f1739f9565e20539495799957
MD5 24b7b3adad8b3bfcbfc5b7a514267277
BLAKE2b-256 8b84876ff9302ad56c8a53f631be8ecb40f1716abdf0e9604f1e7c247d885a31

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