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.post0.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.post0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fundkit-0.1.3.post0.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.post0.tar.gz
Algorithm Hash digest
SHA256 d84aa85e567e1fcc17cacbf3bad5b81488b5267addbc6e93a67122cf816f1b20
MD5 775cc8f1c7e975f2c26da7b2f769d6ba
BLAKE2b-256 f95bb0bc8502ac82877bf59ff1ba912312529f0c2b1b28a7f4a3f6d0ec141724

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fundkit-0.1.3.post0-py3-none-any.whl
  • Upload date:
  • Size: 23.5 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.post0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7bc0923432513f1223e953d2d44b18105b7be03c866aee9e55c376cc9264720
MD5 a9c21db310a8170130300d7cb69904e2
BLAKE2b-256 78e14402b86e1d5b80069d3a1429773671f74a8b317af6d37f8656ec2bfa1224

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