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/amc_{amc_id}.parquet |
Permanent (immutable past data) |
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fundkit-0.1.2.tar.gz.
File metadata
- Download URL: fundkit-0.1.2.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7cc5afb5658a24e4aa9c03d345c44c9bd983f6e12b3c53f6ad70d070b0c0786
|
|
| MD5 |
17bfd6b6c8ed28fa2c427b42cbf95358
|
|
| BLAKE2b-256 |
eb0d22bf5b20e7995944f2e5013790b652bcac3883a7f9aff29d9e6b0642eaf8
|
File details
Details for the file fundkit-0.1.2-py3-none-any.whl.
File metadata
- Download URL: fundkit-0.1.2-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1567eace554a058c3f2d6a89a79cd40ef1e8fcb8edcaad7c2360167a4c38f704
|
|
| MD5 |
3db0479b95e569315160b3c69fe012b4
|
|
| BLAKE2b-256 |
c94cd6a032bd3bd05adb829f8c26b7dd3d2698f14aa3e345e66e8803c17d1643
|