Spaces:
Running
title: Mutual Fund
emoji: π
colorFrom: gray
colorTo: green
sdk: docker
pinned: false
license: apache-2.0
short_description: mutual fund agentic ai
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Mutual Fund Investment Decision Support System API
This is a FastAPI backend for the Mutual Fund Investment Decision Support System. It provides all the functionality of the original Streamlit app through a RESTful API.
Features
- Market data retrieval (Nifty 50, Sensex, etc.)
- Mutual fund data fetching and analysis
- SIP calculator with projections
- Goal-based investment planning
- Portfolio analysis and tracking
- AI-powered investment recommendations
- Portfolio rebalancing suggestions
- Performance reporting
Project Structure
mutual_fund_api/ βββ app/ β βββ init.py β βββ main.py β βββ config.py β βββ models/ β β βββ init.py β β βββ fund_models.py β β βββ portfolio_models.py β β βββ goal_models.py β β βββ ai_models.py β βββ services/ β β βββ init.py β β βββ data_fetcher.py β β βββ sip_calculator.py β β βββ portfolio_analyzer.py β β βββ ai_swarm.py β βββ api/ β β βββ init.py β β βββ endpoints/ β β β βββ init.py β β β βββ market.py β β β βββ funds.py β β β βββ portfolio.py β β β βββ goals.py β β β βββ ai.py β βββ utils/ β βββ init.py β βββ helpers.py βββ requirements.txt βββ .env βββ README.md
Setup
- Clone the repository
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- Windows:
venv\Scripts\activate
- Unix/macOS:
source venv/bin/activate
- Windows:
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file with your Swarms API key - Run the API:
uvicorn app.main:app --reload
API Documentation
Once the server is running, you can access the interactive API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Key Endpoints
Market Data
GET /api/v1/market/indices
- Get market indices data
Funds
GET /api/v1/funds/schemes
- Get all mutual fund schemesGET /api/v1/funds/nav/{scheme_code}
- Get NAV history for a fundGET /api/v1/funds/popular
- Get popular funds by categoryPOST /api/v1/funds/sip-calculate
- Calculate SIP returnsPOST /api/v1/funds/required-sip
- Calculate required SIP for a goalPOST /api/v1/funds/analyze
- Analyze fund performance
Portfolio
POST /api/v1/portfolio/metrics
- Calculate portfolio metricsPOST /api/v1/portfolio/rebalance
- Get rebalancing recommendationsPOST /api/v1/portfolio/performance
- Generate performance reportGET /api/v1/portfolio/template/{template}
- Get portfolio templateGET /api/v1/portfolio/templates
- Get all portfolio templates
Goals
POST /api/v1/goals/dashboard
- Calculate goals dashboard metricsPOST /api/v1/goals/calculate-sip
- Calculate SIP returnsPOST /api/v1/goals/required-sip
- Calculate required SIP for a goalPOST /api/v1/goals/inflation-adjusted
- Calculate inflation-adjusted amount
AI Recommendations
POST /api/v1/ai/analyze
- Get comprehensive AI recommendationsPOST /api/v1/ai/fund-selection
- Get fund selection recommendationsPOST /api/v1/ai/risk-assessment
- Get risk assessmentPOST /api/v1/ai/goal-planning
- Get goal planning recommendations