Metadata-Version: 2.4
Name: mutualfund
Version: 0.1.0
Summary: Tiny, dependency-light client for Indian mutual-fund NAVs from AMFI
Author: Shantanu Anantwar
License: MIT
Project-URL: Homepage, https://github.com/ShantanuAnant/mutualfund
Project-URL: Repository, https://github.com/ShantanuAnant/mutualfund
Project-URL: Issues, https://github.com/ShantanuAnant/mutualfund/issues
Project-URL: Changelog, https://github.com/ShantanuAnant/mutualfund/blob/main/CHANGELOG.md
Keywords: mutual-fund,amfi,nav,india,finance,investing
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Dynamic: license-file

<div align="center">

# mutualfund

**A tiny, dependency-light Python client for Indian mutual-fund NAVs.**

[![PyPI](https://img.shields.io/pypi/v/mutualfund.svg)](https://pypi.org/project/mutualfund/)
[![Python versions](https://img.shields.io/pypi/pyversions/mutualfund.svg)](https://pypi.org/project/mutualfund/)
[![CI](https://github.com/ShantanuAnant/mutualfund/actions/workflows/ci.yml/badge.svg)](https://github.com/ShantanuAnant/mutualfund/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

</div>

---

Get the list of fund houses (AMCs), the latest NAV of every scheme in India, and
each AMC's full master profile — straight from AMFI's public pages. No API key,
no login, no cookies — one function call.

```python
import mutualfund as mf

mf.get_nav(119018)                       # -> 1186.883  (latest NAV; changes daily)
mf.get_amc_profile("ICICI Prudential")   # full AMC profile (sponsor, trustees, ...)
```

AMFI publishes a single plain-text file, [`NAVAll.txt`](https://portal.amfiindia.com/spages/NAVAll.txt),
with the latest NAV of every mutual-fund scheme in India (~14,000 rows), plus a
master profile for each fund house on its member pages. These are free and
public, but they're quirky — a semicolon-delimited dump with fund houses and
categories as bare header lines, and server-rendered profile pages. `mutualfund`
parses all of that for you and hands back clean, typed Python objects.

## Install

```bash
pip install mutualfund
```

The only runtime dependency is [`requests`](https://pypi.org/project/requests/).

## Usage

### List all fund houses (AMCs)

```python
import mutualfund as mf

for amc in mf.get_amcs():
    print(amc.scheme_count, amc.name)
# 357 HDFC Mutual Fund
# 412 SBI Mutual Fund
# ...
```

### Get the latest NAV of a scheme

```python
mf.get_nav(119018)          # -> 1186.883  (latest NAV, or None if unavailable)

scheme = mf.get_scheme(119018)
print(scheme.name)          # "HDFC Large Cap Fund - Growth Option - Direct Plan"
print(scheme.nav, scheme.nav_date)
print(scheme.amc)           # "HDFC Mutual Fund"
print(scheme.category)      # "Large Cap Fund"
```

### All schemes of one fund house

```python
for s in mf.get_schemes("SBI Mutual Fund"):
    print(s.code, s.name, s.nav)
```

### Find a scheme by name

```python
for s in mf.search("Nifty 50 Index"):
    print(s.code, s.name, s.nav)
```

### Reusable client

The module-level helpers share one cached download. For isolated state (or to
control refreshing yourself), use the client directly:

```python
from mutualfund import AMFIClient

client = AMFIClient()
schemes = client.schemes()          # downloads + parses once, then cached
fresh   = client.schemes(refresh=True)   # force a new download
```

Every NAV helper also accepts `refresh=True`:

```python
mf.get_nav(119018, refresh=True)
```

## AMC profiles

Beyond NAVs, AMFI publishes a master profile for each fund house. `mutualfund`
reads those member pages too.

```python
import mutualfund as mf

# Discover every fund house and its AMFI id (one request):
for m in mf.get_amc_members():
    print(m.mf_id, m.name)

# Full profile, by name substring or by AMFI id:
p = mf.get_amc_profile("ICICI Prudential")   # or mf.get_amc_profile(20)

print(p.sebi_regid)          # "MF/003/93/6"
print(p.setup_date)          # 1993-10-12
print(p.sponsors)            # "ICICI Bank Limited and Prudential Plc"
print(p.ceo)                 # "Mr. Nimesh Shah"
print(p.trustees)            # ('Mr. Nilanjan Sinha', 'Mr. Jyotin Mehta', ...)
print(p.custodians)          # ('HDFC Bank Limited', 'Deutsche Bank AG', ...)

for app in p.mobile_apps:    # MobileApp(platform, name, url, developer)
    print(app.platform, app.url)

for link in p.social:        # SocialLink(platform, name, url)
    print(link.platform, link.url)
```

### `AMCProfile` fields

| Group | Fields |
|---|---|
| Identity | `mf_id`, `name`, `amc_name`, `sebi_regid`, `setup_date`, `incorporation_date` |
| Structure | `sponsors`, `trustee_company`, `trustees`, `directors` |
| Personnel | `chairman`, `ceo`, `managing_director`, `cio_equity`, `compliance_officer`, `investor_service_officer` |
| Contact | `address`, `phone`, `fax`, `email`, `email_domain`, `website` |
| Providers | `auditors`, `custodians`, `registrar` |
| Digital | `mobile_apps` (list of `MobileApp`), `social` (list of `SocialLink`) |

`trustees`, `directors` and `custodians` are tuples of names; missing text
fields are `""` and missing dates are `None`.

> **Note:** AMC profiles come from AMFI's server-rendered member pages, so they
> are slightly more fragile than the NAV file — a future redesign of those pages
> could require an update here.

## The `Scheme` object

| Field | Type | Description |
|---|---|---|
| `code` | `int` | AMFI scheme code |
| `name` | `str` | Full scheme name (plan + option) |
| `amc` | `str` | Fund house, e.g. `"HDFC Mutual Fund"` |
| `nav` | `float \| None` | Latest net asset value |
| `nav_date` | `date \| None` | Date the NAV applies to |
| `isin_growth` | `str` | ISIN (Growth / IDCW-Payout) |
| `isin_reinvestment` | `str` | ISIN (IDCW-Reinvestment) |
| `category` | `str` | AMFI category, e.g. `"Large Cap Fund"` |
| `structure` | `str` | `"open"`, `"close"` or `"interval"` |
| `scheme_type` | `str` | `"equity"`, `"debt"`, `"hybrid"`, `"index"`, ... |

A missing NAV or date is `None` — never a silent zero or an exception.

## Scope

This package reads AMFI's public data: scheme NAVs and AMC master profiles. It
deliberately does **not** scrape portfolio holdings, transaction data, or
anything behind a login.

## Limitations & disclaimer

- **NAVs are end-of-day**, as published by AMFI — not live/intraday prices.
- The data comes from AMFI's public file; this project re-publishes it as-is and
  makes no guarantee of accuracy or availability.
- **Not investment advice.** This is a data-access tool, nothing more.

## Links

- **Source & issues:** [github.com/ShantanuAnant/mutualfund](https://github.com/ShantanuAnant/mutualfund)
- **Changelog:** [CHANGELOG.md](https://github.com/ShantanuAnant/mutualfund/blob/main/CHANGELOG.md)

## License

MIT — see [LICENSE](https://github.com/ShantanuAnant/mutualfund/blob/main/LICENSE).
