FinanceGPT is a Python-based personal finance analyzer that uses local AI models to provide personalized spending insights and financial advice. All your data stays local for complete privacy.
- ๐ Comprehensive Spending Analysis - Detailed breakdown by category, time trends, and patterns
- ๐ Interactive Visualizations - Beautiful charts using Plotly for spending insights
- ๐ค Local AI Insights - Personalized financial advice using Ollama (no cloud APIs needed)
- ๐ฐ Savings Simulation - Calculate potential savings by reducing specific categories
- ๐ Privacy-Focused - All analysis happens locally, your data never leaves your computer
- ๐ฑ Beautiful CLI - Rich terminal interface with progress bars and colorful output
- ๐ Sample Data Generator - Built-in tool to create realistic test data
# Clone the repository
git clone <your-repo-url>
cd FinGPT
# Install dependencies
pip install -r requirements.txt# Install Ollama (visit https://ollama.ai)
# On macOS:
brew install ollama
# Start Ollama
ollama serve
# Install a model (in another terminal)
ollama pull llama3.2:3b
# or for a smaller model:
ollama pull llama3.2:1b# Interactive mode
python main.py
# Quick analysis of existing CSV
python main.py --file your_spending.csv
# Generate sample data
python main.py --sampleYour spending data should be a CSV file with these columns:
| Column | Required | Description | Example |
|---|---|---|---|
date |
โ | Transaction date | 2024-01-15 |
category |
โ | Spending category | Groceries |
amount |
โ | Amount spent (positive) | 45.67 |
notes |
โ | Optional description | Weekly shopping |
date,category,amount,notes
2024-01-15,Groceries,45.67,Weekly shopping
2024-01-16,Coffee,4.50,Morning latte
2024-01-17,Dining,23.45,Lunch with friends
2024-01-18,Transport,12.00,Bus fare- Option A: Use the interactive menu to load your CSV file
- Option B: Generate sample data for testing
- Option C: Use command line:
python main.py --file your_data.csv
The analyzer will provide:
- Overview statistics (total spending, averages, transaction count)
- Category breakdown (top spending categories with percentages)
- Time patterns (monthly trends, weekday vs weekend spending)
- Outlier detection (unusually large transactions)
- AI-generated insights (personalized financial advice)
Interactive Plotly charts including:
- ๐ฅง Spending distribution by category (pie chart)
- ๐ Daily spending timeline
- ๐ฅ Category vs weekday heatmap
- ๐ Weekday spending comparison
- ๐ Monthly spending trends
- Select any spending category
- Set a reduction percentage (e.g., 20%)
- See potential monthly and annual savings
- Get AI advice on how to achieve the reduction
FinanceGPT uses local LLM models via Ollama to provide:
- "You tend to overspend on weekends in the dining category"
- "Consider reducing transport costs on weekdays"
- "Your grocery spending is well-controlled compared to similar households"
- Specific strategies for reducing spending in problem areas
- Budget suggestions based on your patterns
- Tips for building better financial habits
- Realistic assessment of proposed spending reductions
- Specific tactics for achieving savings goals
- Ideas for what to do with money saved
FinGPT/
โโโ main.py # Main entry point
โโโ data_loader.py # CSV loading and validation
โโโ analyzer.py # Data analysis and trend detection
โโโ llm_agent.py # Local LLM communication via Ollama
โโโ ui.py # Rich CLI interface
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
โโโ sample_spending.csv # Generated sample data (after first run)
- pandas - Data manipulation and analysis
- plotly - Interactive visualizations
- matplotlib/seaborn - Additional plotting capabilities
- ollama - Local LLM integration
- rich - Beautiful terminal formatting
- click - Command-line interface
- numpy - Numerical computations
You can use different Ollama models by modifying llm_agent.py:
# Lightweight models (faster, less detailed)
llm_agent = FinancialLLMAgent("llama3.2:1b")
llm_agent = FinancialLLMAgent("phi3:mini")
# Standard models (good balance)
llm_agent = FinancialLLMAgent("llama3.2:3b") # default
llm_agent = FinancialLLMAgent("mistral:7b")
# Larger models (more detailed, slower)
llm_agent = FinancialLLMAgent("llama3.1:8b")Modify the categories and spending ranges in data_loader.py:
categories = {
'Groceries': (20, 150),
'Dining': (15, 80),
'Your_Category': (min_amount, max_amount),
# Add more categories...
}โโโโโโโโโโโโโโโโโโโโ Spending Overview โโโโโโโโโโโโโโโโโโโโ
โ Metric โ Value โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Total Spending โ $3,245.67 โ
โ Transactions โ 156 โ
โ Avg Daily โ $54.09 โ
โ Avg Transaction โ $20.81 โ
โ Time Period โ 60 days โ
โโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ค AI Financial Insights:
Based on your spending data, here are my key observations:
**Key Observations:**
Your spending shows a clear pattern with Groceries being your largest
expense at 28% of total spending. You're doing well with consistent
daily averages, but there's room for optimization in dining expenses.
**Areas for Improvement:**
1. Weekend dining spending is 45% higher than weekdays
2. Consider meal planning to reduce grocery waste
3. Transport costs could be optimized with monthly passes
**Action Plan:**
1. Set a weekend dining budget of $30 per weekend
2. Try batch cooking on Sundays to reduce weekday takeout
3. Track coffee purchases - they add up to $87/month
1. "Ollama not available" message
# Install Ollama from https://ollama.ai
# Then run:
ollama serve
ollama pull llama3.2:3b2. CSV loading errors
- Check that your CSV has required columns:
date,category,amount - Ensure dates are in YYYY-MM-DD format
- Verify amounts are positive numbers
3. Visualization not opening
- Make sure you have a default browser set
- Try running with
--browserflag if available
4. Import errors
# Reinstall dependencies
pip install -r requirements.txt --force-reinstall- Check the logs in
financegpt.log - Use the "Check Ollama setup" option in the main menu
- Ensure all dependencies are installed:
pip list
- Extend
analyzer.py- Add new analysis methods - Update
llm_agent.py- Include new data in AI prompts - Modify
ui.py- Add new menu options
Add new chart types in analyzer.py:
def create_custom_visualization(self):
# Your custom Plotly chart
fig = px.your_chart_type(...)
return figThis project is open source. Feel free to modify and distribute.
Contributions welcome! Areas for improvement:
- Additional visualization types
- More sophisticated AI prompts
- Export features (PDF reports)
- Streamlit web interface
- Budget planning features
- Integration with bank APIs
- Streamlit web interface
- PDF report generation
- Budget planning and tracking
- Category-based budgeting
- Expense prediction models
- Integration with popular banking APIs
- Mobile app companion
- Multi-currency support
Happy budgeting! ๐ฐ
Remember: The best financial plan is the one you actually follow. Start small, be consistent, and let FinanceGPT help you build better money habits.