Skip to content

arsfeld/finance-tracker

Repository files navigation

Finance Tracker

Logo

A smart and friendly tool that helps you keep track of your finances using AI! This tool connects to your SimpleFin account, analyzes your transactions, and provides insights about your spending patterns.

✨ Features

  • 🤖 AI-powered analysis of your spending habits
  • 📊 Multiple date range options for analysis
  • 📱 Multiple notification channels:
    • 📧 Email
    • 🔔 Ntfy
  • 💾 Smart caching to prevent duplicate notifications
  • 🔍 Detailed transaction analysis
  • 🎯 Customizable date ranges

🚀 Getting Started

Prerequisites

  • Go 1.x or later
  • A SimpleFin account
  • (Optional) Ntfy account for push notifications
  • (Optional) Logo image hosted at a publicly accessible URL for email templates

🔧 Configuration

Create a .env file in your project root with the following variables:

# Required
SIMPLEFIN_BRIDGE_URL=your_simplefin_bridge_url
OPENROUTER_URL=your_openrouter_url
OPENROUTER_API_KEY=your_openrouter_api_key
OPENROUTER_MODEL=your_preferred_model

# Optional - for email notifications
MAILER_URL=your_mailer_url
MAILER_FROM=your_sender_email
MAILER_TO=recipient_email

# Optional - for Ntfy notifications
NTFY_TOPIC=your_ntfy_topic

🏗️ Building

To build the application, run:

go build -o finance_tracker ./src

🎮 Running

The application supports various command-line flags to customize its behavior:

./finance_tracker [flags]

Available flags:

  • -n, --notifications: Notification types to send (default: ["email", "ntfy"])
  • --disable-notifications: Disable all notifications
  • --disable-cache: Disable database caching
  • --verbose: Enable verbose logging
  • --date-range: Date range type (default: "current_month")
  • --start-date: Start date for custom range (YYYY-MM-DD)
  • --end-date: End date for custom range (YYYY-MM-DD)
  • --force: Force analysis even if database is up to date
  • --env-file: Path to environment file (default: ".env")
  • --version: Show version information
  • --max-retries: Maximum number of retries for LLM calls (default: 5)
  • --retry-delay: Initial retry delay in seconds (default: 2)

Example usage:

# Analyze current month's transactions
./finance_tracker

# Analyze last month's transactions
./finance_tracker --date-range last_month

# Send notifications via ntfy only
./finance_tracker --notifications ntfy

# Force fresh analysis without caching
./finance_tracker --disable-cache

# Analyze custom date range
./finance_tracker --date-range custom --start-date 2024-01-01 --end-date 2024-03-31

# Enable verbose logging
./finance_tracker --verbose

📝 Example Output

Here's an example of what the application output looks like:

10:01AM INF 🔧 Loading configuration...
10:01AM INF 🔄 Loading database...
10:01AM INF 📊 Fetching transactions...
10:01AM INF 💳 Accounts:
10:01AM INF • account_id=ACT-1234-5678-9012 account_name="Sample Credit Card"
10:01AM INF └ balance=-2500.00 sync_time="2024-04-01 02:33:25" transactions=45
10:01AM INF 🤖 Analyzing transactions with AI...
10:01AM INF  └ OpenRouter response model=deepseek/deepseek-chat-v3-0324 provider=Example
10:01AM INF ✨ AI Summary:
10:01AM INF ### Summary
In March 2024, total expenses amounted to **$2,500.00**, with notable spending on groceries, dining, and transportation. Frequent small purchases at local restaurants and coffee shops suggest habitual spending, while larger one-time expenses included a medical visit ($150.00) and a concert ticket ($120.00). Groceries (e.g., Local Market, Super Store) and fuel (Gas Station A, Gas Station B) were recurring costs.

### Analysis Breakdown
1. **Total Expenses**: $2,500.00
2. **Major Categories**:
   - Groceries: $600.00
   - Dining: $450.00
   - Fuel: $300.00
   - Retail: $250.00
   - Subscriptions: $50.00
3. **Largest Expenses**:
   - $150.00: Medical Center on 2024-03-15
   - $120.00: Concert Venue on 2024-03-20
   - $100.00: Department Store on 2024-03-25
4. **Account Status**:
   - Sample Credit Card: Balance -$2,500.00, Last synced 2024-04-01
---
*Generated by deepseek/deepseek-chat-v3-0324*
10:01AM INF 📱 Notifications sent successfully via:
• Email: recipient@example.com
• Ntfy: finance-tracker-test channels="Email: recipient@example.com\n• Ntfy: finance-tracker-test"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •