Skip to main content

DEGIRO portfolio tracking and visualization application

Project description

DEGIRO Portfolio

A web application for tracking and visualizing your DEGIRO portfolio with interactive charts and performance analytics.

Features

Portfolio Management

  • Import DEGIRO transaction exports from Excel spreadsheets
  • Upload new transaction files directly via web interface
  • Automatic fetching of historical stock prices using Yahoo Finance
  • One-click market data updates for all holdings
  • Multi-currency support (EUR, USD, SEK) with automatic conversion
  • SQLite database for efficient data storage and retrieval

Portfolio Overview

  • Real-time portfolio summary with total value and gain/loss
  • Stock cards showing:
    • Current holdings and share count
    • Latest closing price with daily percentage change (▲/▼)
    • Yahoo Finance ticker symbol (clickable → Google Finance)
    • Exchange information
    • Transaction count
  • Market data status showing latest price update date
  • Clickable company names linking to investor relations search
  • Compact, space-efficient design

Interactive Charts

  • Candlestick price charts with buy/sell transaction markers
  • Investment tranche tracking showing individual purchase performance
  • Position value percentage charts (where 100% = break even)
  • Market index comparison (S&P 500, Euro Stoxx 50)
  • Zoom, pan, and hover for detailed information
  • Currency-aware visualization (transactions match price data)

Screenshots

Portfolio Overview

Portfolio Overview Interactive portfolio dashboard showing holdings summary, stock price charts, position value percentage, investment tranche tracking, and market index comparison

Stock Detail View

Stock Detail - Microsoft Detailed view showing Microsoft's performance with multiple chart types including price history, position value %, investment tranches, and performance vs market indices

Technology Stack

  • Backend: FastAPI (Python)
  • Database: SQLite
  • Data Processing: Pandas, SQLAlchemy
  • Stock Data: yfinance
  • Frontend: Vanilla JavaScript with Plotly.js for charts
  • Package Management: uv

Quick Start

# Install dependencies
uv sync

# Setup database and import data (one-time setup)
uv run invoke setup

# Start the server
./degiro-portfolio start

# Open browser to http://localhost:8000

CLI Commands

The degiro-portfolio CLI provides easy server management:

./degiro-portfolio start    # Start the server
./degiro-portfolio stop     # Stop the server
./degiro-portfolio restart  # Restart the server
./degiro-portfolio status   # Check server status

Invoke Tasks

Additional tasks are available via invoke:

uv run invoke start          # Start the server
uv run invoke stop           # Stop the server
uv run invoke restart        # Restart the server
uv run invoke status         # Check server status
uv run invoke setup          # Import data and fetch prices
uv run invoke import-data    # Import transactions from Excel
uv run invoke fetch-prices   # Fetch latest stock prices
uv run invoke db-info        # Show database information
uv run invoke logs           # Show server logs
uv run invoke dev            # Start development server with auto-reload
uv run invoke clean          # Clean generated files
uv run invoke --list         # Show all available tasks

Testing

The project includes a comprehensive Playwright-based test suite covering UI, API endpoints, and interactive features.

# Run all tests
uv run pytest tests/ -v

# Run specific test file
uv run pytest tests/test_portfolio_overview.py -v

# Run with output visible
uv run pytest tests/ -v -s

Test Coverage:

  • Portfolio overview page (17 tests)
  • Stock charts and visualizations (15 tests)
  • API endpoints (14 tests)
  • Interactive features (19 tests)

See tests/README.md for detailed testing documentation.

Project Structure

degiro-portfolio/
├── src/degiro_portfolio/
│   ├── __init__.py
│   ├── database.py          # SQLAlchemy models and database config
│   ├── import_data.py       # Import transactions from Excel
│   ├── fetch_prices.py      # Fetch historical stock prices
│   ├── fetch_indices.py     # Fetch market index data
│   ├── main.py              # FastAPI application
│   └── static/
│       └── index.html       # Frontend interface
├── tests/
│   ├── conftest.py          # Pytest fixtures
│   ├── test_portfolio_overview.py  # UI tests
│   ├── test_stock_charts.py        # Chart tests
│   ├── test_api_endpoints.py       # API tests
│   ├── test_interactive_features.py # Interaction tests
│   └── README.md            # Testing documentation
├── degiro-portfolio         # CLI script for server management
├── tasks.py                 # Invoke tasks for automation
├── Transactions.xlsx        # Your transaction data file
├── example_data.xlsx        # Example demo data (AI & European stocks)
├── degiro-portfolio.db      # SQLite database (generated)
└── pyproject.toml           # Project dependencies

Example Data

The repository includes example_data.xlsx with sample AI and European tech stock transactions for demonstration purposes. To try the application with this demo data:

# Import the example data
uv run python -c "from src.degiro_portfolio.import_data import import_transactions; import_transactions('example_data.xlsx')"

# Fetch prices for the stocks
uv run python src/degiro_portfolio/fetch_prices.py

# Fetch market indices
uv run python src/degiro_portfolio/fetch_indices.py

# Start the server
./degiro-portfolio start

The example portfolio includes:

US Tech Stocks:

  • NVIDIA (NVDA) - 129 shares across 4 purchases
  • Microsoft (MSFT) - 30 shares across 3 purchases
  • Meta (META) - 68 shares across 2 purchases
  • Alphabet/Google (GOOGL) - 57 shares across 2 purchases
  • AMD - 97 shares across 3 purchases

European Tech Stocks:

  • ASML (Netherlands) - 33 shares across 3 purchases
  • SAP (Germany) - 75 shares across 2 purchases
  • Infineon (Germany) - 400 shares across 3 purchases
  • Nokia (Finland) - 900 shares across 2 purchases
  • Ericsson (Sweden) - 1400 shares across 2 purchases
  • STMicroelectronics (France) - 240 shares across 2 purchases

Detailed Setup

  1. Install dependencies:

    uv sync
    
  2. Import transaction data:

    uv run invoke import-data
    # or: uv run python src/stockchart/import_data.py
    
  3. Fetch historical stock prices:

    uv run invoke fetch-prices
    # or: uv run python src/stockchart/fetch_prices.py
    
  4. Start the web server:

    ./degiro-portfolio start
    # or: uv run invoke start
    
  5. Open your browser: Navigate to http://localhost:8000

Usage

Viewing Your Portfolio

Once the application is running, the main page displays:

  • A grid of cards showing all current holdings with share counts
  • Click on any stock card to view its detailed price chart
  • Charts show candlestick price data with buy/sell transaction markers
  • Statistics panel shows key metrics for the selected stock

Updating Data

To update with new transactions:

# Re-import the updated Excel file
uv run python src/stockchart/import_data.py

# Fetch latest prices
uv run python src/stockchart/fetch_prices.py

API Endpoints

  • GET / - Main web interface
  • GET /api/holdings - List all current stock holdings (with latest prices and daily changes)
  • GET /api/stock/{stock_id}/prices - Historical prices for a stock
  • GET /api/stock/{stock_id}/transactions - Transaction history for a stock
  • GET /api/stock/{stock_id}/chart-data - Combined data for chart visualization (includes position percentage)
  • GET /api/portfolio-performance - Portfolio-wide performance metrics
  • GET /api/market-data-status - Get the most recent market data update date
  • POST /api/upload-transactions - Upload new transaction Excel file
  • POST /api/update-market-data - Fetch latest market data for all stocks and indices

Database Schema

Stocks Table

  • Stock metadata (symbol, name, ISIN, exchange)

Transactions Table

  • Transaction history (date, quantity, price, fees, transaction type, currency)
  • Links to stocks via foreign key

Stock Prices Table

  • Historical OHLCV (Open, High, Low, Close, Volume) data
  • Links to stocks via foreign key

Indices Table

  • Market index metadata (symbol, name)

Index Prices Table

  • Historical closing prices for market indices
  • Links to indices via foreign key

Notes

  • The application uses Yahoo Finance ticker symbols mapped from ISIN codes
  • Historical data starts from the earliest transaction date for each stock
  • Charts are interactive and support zooming, panning, and hovering for details
  • Transaction markers are uniform size for clean visualization
  • Stock cards display live prices and daily percentage changes
  • Company names and ticker symbols are clickable for quick access to external resources
  • See PRICING_NOTES.md for details on price data timing and differences from broker platforms

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

degiro_portfolio-0.2.3.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

degiro_portfolio-0.2.3-py3-none-any.whl (47.0 kB view details)

Uploaded Python 3

File details

Details for the file degiro_portfolio-0.2.3.tar.gz.

File metadata

  • Download URL: degiro_portfolio-0.2.3.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for degiro_portfolio-0.2.3.tar.gz
Algorithm Hash digest
SHA256 93624713400e7c3a797ff7762267924d333e0cc4bffb5e7ac76fb63e97ea87fa
MD5 2768e3c47efd7f983c52bd3e4bd833ef
BLAKE2b-256 9ef167ab589cd71f0935947d4f0ea73dda671bd7c7fffcd23ca1a8e63c163f5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for degiro_portfolio-0.2.3.tar.gz:

Publisher: publish.yml on jdrumgoole/degiro-portfolio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file degiro_portfolio-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for degiro_portfolio-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ef04649200cb4a8d9de8f9a428c3135e57314047573f14cee7293f788370a1f9
MD5 e60d4751ac915c19da239efe7d37b93e
BLAKE2b-256 e040ffb6201ccb3bbb2e3eb57a007521692af00345e1546879362a03a2c055b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for degiro_portfolio-0.2.3-py3-none-any.whl:

Publisher: publish.yml on jdrumgoole/degiro-portfolio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page