mutual-fund / README.md
lucifer7210's picture
Update README.md
c6cc481 verified
metadata
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

  1. Clone the repository
  2. Create a virtual environment: python -m venv venv
  3. Activate the virtual environment:
    • Windows: venv\Scripts\activate
    • Unix/macOS: source venv/bin/activate
  4. Install dependencies: pip install -r requirements.txt
  5. Create a .env file with your Swarms API key
  6. Run the API: uvicorn app.main:app --reload

API Documentation

Once the server is running, you can access the interactive API documentation at:

Key Endpoints

Market Data

  • GET /api/v1/market/indices - Get market indices data

Funds

  • GET /api/v1/funds/schemes - Get all mutual fund schemes
  • GET /api/v1/funds/nav/{scheme_code} - Get NAV history for a fund
  • GET /api/v1/funds/popular - Get popular funds by category
  • POST /api/v1/funds/sip-calculate - Calculate SIP returns
  • POST /api/v1/funds/required-sip - Calculate required SIP for a goal
  • POST /api/v1/funds/analyze - Analyze fund performance

Portfolio

  • POST /api/v1/portfolio/metrics - Calculate portfolio metrics
  • POST /api/v1/portfolio/rebalance - Get rebalancing recommendations
  • POST /api/v1/portfolio/performance - Generate performance report
  • GET /api/v1/portfolio/template/{template} - Get portfolio template
  • GET /api/v1/portfolio/templates - Get all portfolio templates

Goals

  • POST /api/v1/goals/dashboard - Calculate goals dashboard metrics
  • POST /api/v1/goals/calculate-sip - Calculate SIP returns
  • POST /api/v1/goals/required-sip - Calculate required SIP for a goal
  • POST /api/v1/goals/inflation-adjusted - Calculate inflation-adjusted amount

AI Recommendations

  • POST /api/v1/ai/analyze - Get comprehensive AI recommendations
  • POST /api/v1/ai/fund-selection - Get fund selection recommendations
  • POST /api/v1/ai/risk-assessment - Get risk assessment
  • POST /api/v1/ai/goal-planning - Get goal planning recommendations