Skip to content

About

Production-grade Mutual Fund Analytics Platform - Azure + Python + Power BI

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

57 Commits

Folders and files

Repository files navigation

Mutual Fund Analytics Platform

Production-style, enterprise-grade Mutual Fund Analytics Platform demonstrating end-to-end Data Engineering, Advanced Analytics, Cloud Architecture, and Executive BI Reporting.

Built by: Sumit Kumar Prajapat | GitHub: Skpkush

Status: βœ… Complete. The Azure pipeline ran end to end during the 15-day Azure trial (see screenshot). The app now runs from Supabase or, when that is offline, a data snapshot in this repo.

πŸ”΄ Live Demo: mf-analytics-platform.streamlit.app

Live Demo Python Pandas PostgreSQL Azure Power BI Prophet Streamlit License


πŸ“Š Key Metrics

Metric Value Basis
Live schemes 8,620 across 50 AMCs NAV dated in the snapshot's final month (2026-05)
Schemes listed by AMFI 14,368 across 51 AMCs Includes closed and matured schemes
Daily NAV rows 9,706,307 12,810 schemes, 2021-06-02 to 2026-05-31
ETFs + benchmark indices 11 + 5 The series behind the app's risk and trend pages
Star schema 5 dimension + 4 fact tables Dim_Fund holds 14,384 rows: listed schemes + ETFs + indices
Power BI 4 pages, 37 DAX measures Screenshots show 4,961 funds / 52 AMCs, the set with metrics when it was built
Streamlit app 7 pages Runs from a repo snapshot if the database is down
Moderate-risk shortlist 179 β†’ 49 β†’ 5 funds Average drawdown -3.62% vs -4.83% for peers, 11 test windows
Trend model check 7.77% vs 5.8% error at 90 days Prophet vs a no-change baseline; 32.7% coverage from its 80% band
Investor data 500 investors, 35,280 transactions Synthetic, used for the Investor Analytics demo page only

Every number above is generated from the data into docs/metrics.json, and a test fails if this table drifts from it. Quote project numbers from that file only.


🎯 Business Problem

Asset Management Companies, Wealth Advisors, and FinTech firms need a unified analytics platform that ingests multi-source mutual fund data, computes risk-adjusted performance metrics, segments investors, explores NAV trends, and surfaces executive-level insights β€” all in a scalable cloud architecture.

This platform delivers exactly that.

πŸ’Ό Business Question

Which 5 funds should an advisor suggest to a moderate-risk client?

Starting from 179 Direct-Growth schemes in seven suitable categories, the screen applies a risk gate relative to the Nifty 50, then picks the best-scoring basket under diversification limits. A walk-forward test shows what the method does and does not deliver:

Approach Avg 1Y return Avg worst fall
This shortlist 9.63% βˆ’3.62%
Same-category peers 9.52% βˆ’4.83%
Top 5 by last year's return 7.96% βˆ’6.16%

The finding: the edge is smaller falls, not higher returns. Return matched peers, while the worst fall was shallower in all 11 overlapping test windows. The full answer, method and limits are in docs/analysis/moderate_risk/, and in the app's Advisor Shortlist page. This is a historical analysis, not investment advice.


πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Data Sources   │───▢│   Azure Blob    │───▢│  Azure Data     β”‚
β”‚  Yahoo Finance  β”‚    β”‚   (Raw Layer)   β”‚    β”‚   Factory       β”‚
β”‚  AMFI India     β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  (βœ… Succeeded) β”‚
β”‚  Kaggle         β”‚                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                     β”‚
                                                        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Streamlit App  │◀───│  Power BI       │◀───│  Azure SQL DB   β”‚
β”‚(Streamlit Cloud)β”‚    β”‚  4-Page         β”‚    β”‚  Star Schema    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  Dashboard      β”‚    β”‚  5 Dim + 4 Fact β”‚
        β–²              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                                              β”‚
        β”‚                                              β–Ό
        β”‚                                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        └─────────────────────────────────────│  Python ML      β”‚
                                              β”‚  Prophet NAV    β”‚
                                              β”‚  Trend          β”‚
                                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data flow: Raw multi-source data lands in Azure Blob β†’ Azure Data Factory orchestrates ingestion β†’ transformation/cleaning in Python β†’ load into a star schema (5 dimension + 4 fact tables) on Azure SQL Database (PostgreSQL locally) β†’ 37 DAX measures power a 4-page Power BI dashboard β†’ Prophet separates NAV trend from noise β†’ Streamlit surfaces client-facing analytics.

Full diagram: docs/architecture/architecture.md

Star Schema (5 Dim + 4 Fact)

  • Dimensions: Dim_Date, Dim_AMC, Dim_Category, Dim_Fund, Dim_Investor
  • Facts: Fact_NAV, Fact_Transactions, Fact_SIP, Fact_Returns

DDL: scripts/sql/ddl/ Β· Views: scripts/sql/views/ Β· Procs: scripts/sql/procs/


πŸ› οΈ Tech Stack

Layer Technology
Cloud Azure (Blob Storage, SQL Database, Data Factory, Functions, Key Vault)
Database Azure SQL Database (cloud) + PostgreSQL 15 (local/fallback)
ETL Azure Data Factory + Python (pandas 2.x, sqlalchemy)
Analytics Python (numpy, scipy, statsmodels)
ML Prophet (NAV trend exploration)
BI Power BI Desktop β€” 4 pages, 37 DAX measures
App Streamlit (deployed on Streamlit Community Cloud)
Orchestration ADF pipelines + Azure Functions
Version Control Git + GitHub

πŸ“Š Dashboard Pages (Power BI)

πŸ“₯ Download: Power BI Dashboard (.pbix) (Git LFS) Β· πŸ–ΌοΈ Screenshots: docs/screenshots/

  1. Executive Overview β€” AUM, top funds, market summary, KPIs
  2. Fund Performance Analytics β€” CAGR, rolling returns, benchmark comparison
  3. Investor Analytics β€” SIP trends, segmentation, retention (synthetic demo data: 500 investors)
  4. Risk & Volatility β€” Sharpe heatmaps, drawdown, risk-return scatter

πŸ–ΌοΈ Dashboard Screenshots

Page 1 β€” Executive Overview Executive Overview

Page 2 β€” Fund Performance Analytics Fund Performance

Page 3 β€” Investor Analytics Investor Analytics

Page 4 β€” Risk & Volatility Risk & Volatility

Azure Data Factory Pipeline β€” Succeeded Azure ADF Pipeline β€” Succeeded


πŸ“ˆ Financial Metrics Implemented

  • CAGR (Compound Annual Growth Rate)
  • Rolling Returns (1Y, 3Y, 5Y)
  • Alpha, Beta (vs Nifty 50 benchmark)
  • Sharpe Ratio, Sortino Ratio, Treynor Ratio
  • Standard Deviation, Volatility
  • Maximum Drawdown
  • Information Ratio

πŸ€– ML Module

NAV Trend Exploration (Prophet) separates a fund's trend from noise and shows its direction and how far the NAV sits from it. It is not a forecast: in a walk-forward backtest across 11 ETFs, Prophet lost to a no-change baseline at 30, 60 and 90 days, and its 80% band held only about a third of the time.

python scripts/ml/nav_trend.py --fund-code NIFTYBEES.NS   # trend scenario for one fund
python scripts/ml/backtest_nav_trend.py                   # walk-forward backtest
streamlit run streamlit/app.py                            # interactive app

▢️ How to Run

1. Setup

# Clone repo
git clone https://github.com/Skpkush/mf-analytics-platform.git
cd mf-analytics-platform

# Create virtual environment
python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Configure environment variables
cp .env.example .env            # Windows: copy .env.example .env
# Edit .env with your Azure / PostgreSQL credentials

2. Ingest data

python scripts/ingestion/fetch_yahoo_finance.py
python scripts/ingestion/fetch_amfi_nav.py

3. Transform & load (build the star schema)

# Clean and validate NAV / transaction history
python scripts/transformation/clean_nav.py
python scripts/transformation/clean_transactions.py

# Create the schema (DDL), then load dimensions and facts
python scripts/etl/run_ddl.py
python scripts/etl/load_dimensions.py
python scripts/etl/load_facts.py

4. Compute analytics

python scripts/analytics/metrics_returns.py        # CAGR, rolling returns
python scripts/analytics/metrics_risk.py           # volatility, drawdown
python scripts/analytics/metrics_risk_adjusted.py  # Sharpe, Sortino, Treynor, alpha/beta
python scripts/analytics/metrics_market.py         # market/AUM aggregates

5. Explore trends and run the advisor analysis

python scripts/ml/nav_trend.py --list                       # funds with enough history
python scripts/ml/nav_trend.py --fund-code NIFTYBEES.NS     # trend plus 30/60/90-day scenario
python scripts/etl/build_app_snapshot.py                    # offline data for the app
python scripts/ml/backtest_nav_trend.py                     # is the trend a usable prediction?
python scripts/analytics/moderate_risk_shortlist.py         # the 5-fund business question
python scripts/analytics/build_metrics_manifest.py          # refresh docs/metrics.json + README table

6. Explore the dashboard & app

  • Power BI: open powerbi/mf_analytics_dashboard_p4.pbix (apply theme powerbi/theme_mf_analytics.json).
  • Streamlit: streamlit run streamlit/app.py β†’ open http://localhost:8501 (no database needed, it falls back to the repo snapshot; deploy notes in streamlit/README.md).

Cloud path: the Azure Data Factory pipeline orchestrates the ingestion β†’ blob β†’ SQL load in the cloud (pipeline run Succeeded β€” see screenshot above). Run the cloud ETL via scripts/etl/run_azure_etl.py / scripts/etl/trigger_adf_pipeline.py.


πŸ“ Project Structure

mf-analytics-platform/
β”œβ”€β”€ azure/
β”‚   β”œβ”€β”€ adf_pipelines/        # ADF JSON pipeline definitions
β”‚   β”œβ”€β”€ alerts/               # ADF failure alert configurations
β”‚   β”œβ”€β”€ arm_templates/        # Infrastructure as code
β”‚   β”œβ”€β”€ datasets/             # ADF dataset definitions
β”‚   β”œβ”€β”€ functions/
β”‚   β”‚   └── fn_compute_daily_metrics/  # Azure Function daily refresh
β”‚   β”œβ”€β”€ pipelines/            # ADF pipeline JSON definitions
β”‚   └── triggers/             # ADF schedule triggers
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ raw/                  # AMFI + Yahoo source parquet
β”‚   β”œβ”€β”€ processed/            # Cleaned, transformed data
β”‚   └── app/                  # Offline snapshot the Streamlit app can run from
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ analysis/             # Moderate-risk shortlist + trend backtest
β”‚   β”œβ”€β”€ architecture/         # Architecture diagrams + Mermaid
β”‚   β”œβ”€β”€ case_study/           # Case study PDF (planned)
β”‚   β”œβ”€β”€ screenshots/          # Dashboard + pipeline screenshots
β”‚   β”œβ”€β”€ daily_log.md          # Day-by-day build log
β”‚   β”œβ”€β”€ data_dictionary.md    # Schema + field definitions
β”‚   └── metrics.json          # Numbers of record
β”œβ”€β”€ notebooks/
β”‚   └── 01_data_exploration.ipynb  # EDA notebook
β”œβ”€β”€ powerbi/
β”‚   β”œβ”€β”€ mf_analytics_dashboard_p4.pbix  # 4-page dashboard (Git LFS)
β”‚   └── theme_mf_analytics.json         # Navy theme file
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ ingestion/            # AMFI + Yahoo Finance data acquisition
β”‚   β”œβ”€β”€ transformation/       # Cleaning, validation, feature engineering
β”‚   β”œβ”€β”€ etl/                  # DDL run, dimension/fact load, Azure ETL
β”‚   β”œβ”€β”€ analytics/            # Metrics, advisor shortlist, numbers of record
β”‚   β”œβ”€β”€ ml/                   # Prophet NAV trend + walk-forward backtest
β”‚   └── sql/
β”‚       β”œβ”€β”€ ddl/              # CREATE TABLE scripts (star schema)
β”‚       β”œβ”€β”€ views/            # Analytical views (vw_fund_performance)
β”‚       └── procs/            # Stored procedures
β”œβ”€β”€ streamlit/
β”‚   β”œβ”€β”€ .streamlit/           # Theme + secrets template
β”‚   β”œβ”€β”€ pages/                # 6 app pages (Explorer, Trend, Risk, SIP, Portfolio, Advisor)
β”‚   β”œβ”€β”€ utils/                # DB, metrics, charts utilities
β”‚   β”œβ”€β”€ app.py                # Home page + KPI cards
β”‚   β”œβ”€β”€ Dockerfile            # Container definition
β”‚   β”œβ”€β”€ docker-compose.yml    # VPS deployment config (alternative)
β”‚   β”œβ”€β”€ requirements.txt      # App-only dependencies
β”‚   └── README.md             # Deploy instructions
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ conftest.py           # Pytest fixtures
β”‚   β”œβ”€β”€ test_data_quality.py  # Data quality unit tests
β”‚   └── test_analysis_and_numbers.py  # Shortlist logic + number checks
β”œβ”€β”€ .env.example              # Environment variable template
β”œβ”€β”€ .gitignore                # Secrets + venv excluded
β”œβ”€β”€ CLAUDE.md                 # Claude Code project context
β”œβ”€β”€ PROJECT_PLAN.md           # Week-by-week execution plan
β”œβ”€β”€ requirements.txt          # Full Python dependencies
└── README.md

πŸ“„ Documentation


πŸ“œ License

MIT License β€” see LICENSE file.


πŸ‘€ Author

Sumit Kumar Prajapat Data Analyst | Analytics Engineer | πŸ“§ sumitkprajapat29@gmail.com πŸ”— GitHub


Last updated: November 2026

About

Production-grade Mutual Fund Analytics Platform - Azure + Python + Power BI

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages