Skip to content

FamilDardashti/expense_tracker

Repository files navigation

Expense Tracker

Expense Tracker is a lightweight command‑line application for recording daily spending in a CSV file and generating useful summaries and charts. It is ideal for quickly tracking expenses without relying on a full database or web interface.

Table of Contents

Features

  • Add expense entries with a date, amount, category, and optional description.
  • Show the most recent entries or filter history by date range or category.
  • Produce a summary that reports totals by category and the average daily spending. The output is saved to reports/summary.txt.
  • Visualize expenses with bar and line charts saved in the reports directory.

Getting Started

Prerequisites

  • Python 3.10+
  • Python packages: pandas, matplotlib, and tabulate

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd expense_tracker
  2. (Optional) Create and activate a virtual environment.

  3. Install the dependencies:

    pip install pandas matplotlib tabulate
  4. Create folders for data storage and generated reports:

    mkdir -p data reports

Usage

Run the CLI by invoking main.py with one of the available commands.

python main.py <command> [--argument value]

Adding an expense

python main.py add --date 2025-07-01 --amount 120 --category food --description "grocery shopping"

Viewing history

python main.py history
python main.py history --last 5
python main.py history --filtered_by date --date_range_from 2025-07-01 --to 2025-07-15
python main.py history --filtered_by category --category food

Summary

python main.py summary

Visualization

python main.py visualize

The visualization command produces a bar chart of spending by category and a line chart of daily totals. Both images are saved under reports/.

Project Structure

├── expense.py      # Expense data model
├── main.py         # Command-line interface
├── manager.py      # CSV storage and history filtering
├── report.py       # Summary generation
├── utils.py        # Input validators
└── visualize.py    # Chart rendering

Contributing

Contributions, issues, and feature requests are welcome. Feel free to open a pull request or submit an issue on GitHub.

License

This project is provided without a specific license. Use at your own discretion.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages