Democratizing professional-grade financial planning through AI
An intelligent financial planning system that integrates Large Language Models (Google Gemini 2.5) with sophisticated mathematical modeling to provide comprehensive, personalized financial advisory services. Built as part of research at KLE Technological University.
- Features
- Architecture
- Quick Start
- Installation
- Usage Examples
- Research Paper
- Technology Stack
- Project Structure
- API Documentation
- Screenshots
- Validation & Results
- Contributing
- Team
- License
- Citation
- Multi-Goal Management: Track retirement, house purchase, education, emergency funds simultaneously
- Inflation Adjustment: All projections account for 6% inflation (configurable)
- Progress Tracking: Visual progress bars showing % completion for each goal
- Priority Management: Classify goals as Essential, Important, or Aspirational
- Corpus Calculation: Based on 4% safe withdrawal rule (Trinity Study)
- Lifestyle Options: Frugal (70%), Same (100%), Comfortable (120%), Luxurious (150%)
- Alternative Scenarios: "What if I retire 2 years early?" analysis
- Withdrawal Strategy: Recommended post-retirement income plan
- 10,000 Iterations: Probabilistic forecasting with realistic market volatility
- Success Probability: Know your chances (e.g., "78% probability of achieving goal")
- Percentile Analysis: See best/worst/median outcomes
- Risk Assessment: 10th, 25th, 50th, 75th, 90th percentile projections
- 6-24 Month Projections: Short-term financial planning
- Surplus/Deficit Identification: Know when you'll have extra or fall short
- Emergency Fund Analysis: Recommendations for building safety net
- Visual Timeline: Month-by-month breakdown with charts
- Real-Time Data: Live prices from Yahoo Finance
- Interactive Charts: Candlestick, line, and area charts with Plotly
- Multiple Timeframes: 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, max
- Technical Indicators: 52-week high/low, volume analysis
- News Integration: Latest market news for tracked stocks
- Natural Language: Ask questions like "Can I retire at 55?"
- Document Analysis: Upload PDFs (financial statements, reports)
- Web Search Integration: Real-time financial news and market commentary
- Context Retention: Remembers conversation history
- Indian Stocks: NSE/BSE listings
- Market Indices: NIFTY 50, SENSEX
- Currency: βΉ (Rupee) formatting
- Local Context: Tax considerations, investment patterns
βββββββββββββββββββββββββββββββββββββββββββββββ
β Streamlit Frontend (UI) β
β - Chat Interface β
β - Goal Planner Forms β
β - Interactive Charts (Plotly) β
β - Multi-page Navigation β
ββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β REST API (HTTP/JSON)
β
ββββββββββββββββΌβββββββββββββββββββββββββββββββ
β FastAPI Backend (Python) β
β - Financial Calculation Engine β
β - Monte Carlo Simulation (NumPy) β
β - API Orchestration β
β - Business Logic β
ββββββ¬ββββββββββββββββββ¬βββββββββββββββββββββββ
β β
ββββββΌββββββ ββββββΌβββββββ
β Yahoo β β Gemini β
β Finance β β AI 2.5 β
β API β β (LLM) β
ββββββββββββ βββββββββββββ
Three-Tier Design:
- Presentation Layer: Streamlit web interface
- Application Layer: FastAPI backend with business logic
- Data Layer: External APIs (Yahoo Finance, Google Gemini)
- Python 3.11 or higher
- Google Gemini API key (Get one free)
- 8GB RAM minimum
- Internet connection
# 1. Clone repository
git clone https://github.com/yourusername/fintech-agent.git
cd fintech-agent
# 2. Install dependencies
pip install -r requirements.txt
# 3. Configure API key
echo "GEMINI_API_KEY=your_api_key_here" > .env
# 4. Start backend (Terminal 1)
python backend.py
# 5. Start frontend (Terminal 2)
streamlit run frontend.pyThat's it! Open http://localhost:8501 in your browser.
# Clone repository
git clone https://github.com/yourusername/fintech-agent.git
cd fintech-agent
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Create .env file
cat > .env << EOF
GEMINI_API_KEY=your_actual_api_key_here
EOF
# Verify installation
python -c "import fastapi, streamlit, plotly; print('β All packages installed')"docker-compose upconda create -n fintech python=3.9
conda activate fintech
pip install -r requirements.txt# User: "I'm 35, want to retire at 60 with βΉ5 crore. I have βΉ10L saved."
Input in UI:
- Current Age: 35
- Retirement Age: 60
- Current Savings: βΉ10,00,000
- Monthly SIP: βΉ25,000
- Expected Return: 12%
Output:
β
Projected Corpus: βΉ5.2 Cr
π° Surplus: βΉ20L
π Success Probability: 87%
π― Recommendation: You're on track! Consider using surplus for other goals.# Goal: Save βΉ40L in 6 years for house
Input:
- Target: βΉ40,00,000
- Timeline: 6 years
- Current Savings: βΉ5,00,000
- Monthly SIP: βΉ35,000
- Expected Return: 10%
Output:
β οΈ Shortfall: βΉ3.2L
π Required Monthly: βΉ38,500
π‘ Action: Increase SIP by βΉ3,500/month OR extend timeline by 6 months# Managing 3 goals simultaneously:
Emergency Fund (Essential): βΉ9L in 1 year
House (Important): βΉ40L in 6 years
Retirement (Essential): βΉ5Cr at age 60
System Output:
Priority 1: Emergency (βΉ75K/month for 12 months)
Priority 2: Retirement (βΉ25K/month starting now)
Priority 3: House (βΉ35K/month after emergency complete)
Total Initial: βΉ100K/month
After 1 year: βΉ60K/month- FastAPI 0.104.1 - Async REST API framework
- Pydantic 2.5.0 - Data validation
- NumPy 1.24.3 - Monte Carlo simulations
- yfinance 0.2.32 - Yahoo Finance API wrapper
- httpx 0.25.1 - Async HTTP client
- Streamlit 1.29.0 - Web interface
- Plotly 5.18.0 - Interactive visualizations
- Pandas 2.1.3 - Data manipulation
- Google Gemini 2.5 Flash - Large Language Model
- Google Search - Real-time financial data
- PyPDF2 3.0.1 - PDF document analysis
fintech-agent/
β
βββ backend.py # FastAPI server with all APIs
βββ frontend.py # Streamlit UI application
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variables template
βββ README.md # This file
β
βββ docs/
β βββ research_paper.pdf # Academic paper
β βββ presentation.pdf # Research presentation
β βββ user_guide.pdf # Detailed usage guide
β
βββ assets/
β βββ demo.gif # Demo animation
β βββ screenshot1.png # Goal planner UI
β βββ screenshot2.png # Retirement calculator
β βββ architecture.png # System diagram
β
βββ tests/
β βββ test_calculations.py # Unit tests for math
β βββ test_api.py # API endpoint tests
β βββ test_monte_carlo.py # Simulation validation
β
βββ notebooks/
βββ validation.ipynb # Mathematical validation
βββ user_study.ipynb # User study analysis
http://localhost:8000
POST /api/chat
Content-Type: application/json
{
"messages": [
{
"role": "user",
"parts": [{"text": "Can I retire at 55?"}]
}
],
"document_text": "optional PDF content"
}
Response: {
"response": "Based on your profile..."
}POST /api/goals/analyze
{
"name": "House Down Payment",
"target_amount": 4000000,
"current_savings": 500000,
"monthly_contribution": 35000,
"years_to_goal": 6,
"expected_return": 10.0,
"inflation_rate": 6.0,
"priority": "Important",
"goal_type": "House"
}
Response: {
"projected_amount": 3720000,
"surplus_or_shortfall": -280000,
"is_achievable": false,
"monthly_required": 38500,
"progress_percentage": 12.5,
"probability_of_success": 45.2,
"recommendation": "Increase SIP by βΉ3,500...",
"year_by_year_projection": [...]
}POST /api/retirement/analyze
{
"current_age": 35,
"retirement_age": 60,
"life_expectancy": 85,
"current_monthly_expenses": 50000,
"lifestyle_multiplier": 1.2,
"existing_savings": 1000000,
"monthly_sip": 25000,
"expected_return": 12.0,
"inflation_rate": 6.0
}
Response: {
"required_corpus": 64400000,
"projected_corpus": 52000000,
"surplus_or_shortfall": -12400000,
"is_achievable": false,
...
}GET /api/stock/AAPL
Response: {
"info": {
"longName": "Apple Inc.",
"currentPrice": 178.25,
"marketCap": 2800000000000,
...
},
"history": [...],
"news": [...]
}POST /api/cashflow/forecast
{
"monthly_income": 120000,
"monthly_expenses": 85000,
"existing_savings": 300000,
"months_to_forecast": 12
}
Response: {
"monthly_forecast": [...],
"average_monthly_surplus": 35000,
"deficit_months": [],
"total_savings_end": 720000,
"insights": [...]
}π Interactive API Docs: http://localhost:8000/docs (Swagger UI)
| Test Case | Manual Calculation | System Output | Accuracy |
|---|---|---|---|
| Goal FV (βΉ10L + βΉ20K/mo Γ 10y @ 12%) | βΉ77,92,467 | βΉ77,92,467 | 100.0% |
| Retirement Corpus (Age 35β60) | βΉ6.44 Cr | βΉ6.44 Cr | 99.8% |
| Monte Carlo Mean (10K runs) | βΉ76.23L | βΉ76.19L | 99.9% |
| Metric | Score | Result |
|---|---|---|
| Ease of Use | 4.6/5 | βββββ |
| Goal Clarity | 4.8/5 | βββββ |
| Recommendation Quality | 4.4/5 | ββββ |
| Trust in Calculations | 4.2/5 | ββββ |
| Overall Satisfaction | 92% | π |
| Operation | Average Time | 95th Percentile |
|---|---|---|
| Goal Analysis | 1.2s | 1.8s |
| Monte Carlo (10K) | 0.8s | 1.1s |
| Stock Chart | 2.1s | 3.2s |
We welcome contributions! Here's how you can help:
- π Report Bugs: Open an issue with detailed reproduction steps
- π‘ Suggest Features: Share your ideas in Issues
- π Improve Documentation: Fix typos, add examples
- π§ Submit Code: See guidelines below
# Fork and clone
git clone https://github.com/yourusername/fintech-agent.git
cd fintech-agent
# Create feature branch
git checkout -b feature/your-feature-name
# Make changes and test
python -m pytest tests/
# Commit with clear message
git commit -m "Add: detailed description of your changes"
# Push and create PR
git push origin feature/your-feature-name- Python: Follow PEP 8
- Docstrings: Use Google style
- Type Hints: Add for all functions
- Tests: Write for new features
# Run all tests
pytest
# With coverage
pytest --cov=. --cov-report=html
# Specific test
pytest tests/test_calculations.py::test_future_valueThis project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 Abhinandan Onajol, Ajinkya Goundakar, Sakshi Hooli,
Shreya Kutre, Tabassum Jahagirdar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software...
- Google Gemini Team for providing free API access
- Yahoo Finance for market data APIs
- Streamlit for the amazing rapid prototyping framework
- FastAPI for the modern, fast web framework
- KLE Tech University for research support and resources
- Open Source Community for excellent libraries
- Issues: GitHub Issues
- Email: abhinandanvanajol8@gmail.com
- Documentation: Wiki
- Discussions: GitHub Discussions
Is this system SEBI-registered?
No. This is an educational tool for research purposes. It provides information and calculations but not personalized investment advice. Consult a registered financial advisor for major decisions.
How accurate are the projections?
Mathematical calculations are 99.9% accurate vs. manual computation. However, projections depend on assumptions (expected returns, inflation) which may not hold in all market conditions. We use conservative estimates based on historical data.
Can I use this for my startup/business?
Yes! It's open-source (MIT License). You're free to use, modify, and distribute. We'd appreciate attribution and would love to hear how you're using it.
Does it work with US stocks?
Yes! Yahoo Finance provides global market data. Works with US (NYSE, NASDAQ), Indian (NSE, BSE), and most international markets.
How do I get a Gemini API key?
Visit https://makersuite.google.com/app/apikey, sign in with Google, and create a free API key. Current free tier includes 60 requests/minute.
Can I run this offline?
Partially. Financial calculations work offline. However, you need internet for: Gemini AI responses, stock market data, and real-time news.
How do I update to the latest version?
git pull origin main
pip install -r requirements.txt --upgradeIf this project helped you, please consider:
- β Starring the repository
- π΄ Forking for your own use
- π’ Sharing with others who might benefit
- π° Sponsoring future development
- π Writing about your experience
