Skip to main content

Async-first Python library for Mutual Fund data and analytics

Project description

Python Version PyPI Version License


Async Python library for Indian mutual fund analytics. FundKit includes native parsers which fetch NAV info directly from AMFI - no third-party APIs.

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

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

Pandas export:

pip install fundkit[pandas]

Modules

Area Status
data NAV, historical NAV, scheme details
schema Pydantic models (e.g. SchemeDetails)
portfolio, analytics, tax, sip, compare, ... planned
Client Purpose
NAVClient Latest NAV by scheme code, name, AMC, or fund type
HistoricalNAVClient NAV over a date range
SchemeDetailsClient Scheme metadata (category, launch date, minimum investment, ...)

DataFrame methods default to Polars. Pass df_format="pandas" for pandas. get_scheme_details returns a SchemeDetails model; bulk lookups return a DataFrame.

Shared helpers: scheme validation, code/AMC listing. See the data module docs.

Usage

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


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

        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")

        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",
        )

    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())

verbose=True logs cache hits and network fetches. Architecture, caching, and the full API are in src/fundkit/data/README.md.

Compared to typical MF libraries

Many libraries wrap mfapi.in (or similar), use synchronous requests, and return dicts or pandas on every call. That is fine for one-off scripts; it is awkward in async apps or when filtering large scheme lists repeatedly.

Typical MF libraries FundKit
Data source Third-party proxy AMFI
Execution Sync (requests) Async (httpx)
Default output Dict / JSON / pandas Polars DataFrame
Bulk filtering Python loops Polars
Caching Often none Memory → disk (parquet) → network
Schemas Untyped dicts Fixed column names and dtypes

FundKit does not aim to match every feature elsewhere (performance metrics, JSON export, MCP servers, etc.). The current focus is the data layer.

Caching

Repeated same-day calls use local cache instead of re-downloading from AMFI.

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 NAV is not re-fetched once cached. Latest NAV refreshes when the calendar day changes.

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.4.tar.gz (19.2 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.4-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fundkit-0.1.4.tar.gz
  • Upload date:
  • Size: 19.2 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.4.tar.gz
Algorithm Hash digest
SHA256 f869af485b9f2bab0847e06807d06f6bad7b344eda3060499f4f0f95ae8bc8fb
MD5 ad4f04b6129ec31db31eb142df786b34
BLAKE2b-256 8eaa51e329ca9c1fb390b0362ba602ef3867fba60f289880bfa779f96f000553

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fundkit-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 26.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 359cb394edb6cefa7afef322fcebd5da9df53692e9feee1fac00bc9e780192c9
MD5 e2f589d46005ecfc1c9b87582b7df4ac
BLAKE2b-256 592b7d06973047ee6efc28404e31f7be16946806e4e185bfafc2d0f90418da6b

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