Skip to content

Collint25/PortfolioTracker

Repository files navigation

Portfolio Tracker

A personal investment tracking application that syncs transaction history from Fidelity via the SnapTrade API. Built for tracking trades, analyzing performance, and organizing multi-leg options strategies.

Features

  • Automatic Sync - Daily synchronization with Fidelity brokerage accounts via SnapTrade
  • Transaction History - Browse, search, and filter all trades
  • Multi-leg Grouping - Automatically groups related options legs (spreads, condors, etc.)
  • Tags & Notes - Annotate trades with custom tags and comments
  • P/L Tracking - Realized and unrealized profit/loss calculations
  • Dashboard - Portfolio summary with performance metrics

Tech Stack

  • Backend: FastAPI + SQLAlchemy + SQLite
  • Frontend: Jinja2 + HTMX + Tailwind CSS + DaisyUI
  • Data: SnapTrade API (Fidelity integration)
  • Package Manager: uv

Getting Started

Prerequisites

  • Python 3.11+
  • uv package manager
  • SnapTrade API credentials (sign up here)

Installation

# Clone the repository
git clone https://github.com/Collint25/PortfolioTracker.git
cd PortfolioTracker

# Install dependencies
uv sync --extra dev

# Copy environment template
cp .env.example .env

# Run database migrations
uv run alembic upgrade head

# Start the development server
uv run python run.py

The app will be available at http://127.0.0.1:8000

Configuration

Create a .env file with the following variables:

# SnapTrade API credentials
SNAPTRADE_CLIENT_ID=your_client_id
SNAPTRADE_CONSUMER_KEY=your_consumer_key

# SnapTrade user (from registered user)
SNAPTRADE_USER_ID=your_user_id
SNAPTRADE_USER_SECRET=your_user_secret

# Database (optional, defaults to SQLite)
DATABASE_URL=sqlite:///./portfolio.db

Usage

Development

Running Tests

uv run pytest

Database Migrations

# Create a new migration
uv run alembic revision --autogenerate -m "description"

# Apply migrations
uv run alembic upgrade head

Project Structure

PortfolioTracker/
├── app/
│   ├── models/          # SQLAlchemy ORM models
│   ├── routers/         # FastAPI route handlers
│   ├── services/        # Business logic
│   └── templates/       # Jinja2 HTML templates
├── alembic/             # Database migrations
├── tests/               # Pytest test suite
├── docs/                # Project documentation
└── run.py               # Development server entry point

Roadmap

See docs/PROJECT_PLAN.md for detailed phase-by-phase deliverables.

  • Phase 0: Project initialization
  • Phase 1: Foundation (scaffold, database, SnapTrade auth)
  • Phase 2: Data sync
  • Phase 3: Transaction UI
  • Phase 4: Tags & comments
  • Phase 5: Trade groups (multi-leg)
  • Phase 6: Metrics & dashboard

Screenshots

License

Acknowledgments

  • SnapTrade for brokerage API access
  • DaisyUI for UI components
  • HTMX for hypermedia-driven interactions

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors