Open source Β· Self-hosted Β· MIT license

Your portfolio. Your server.
Your rules.

pfm keeps your investments β€” shares, ETFs, funds, crypto β€” and your bank spending in one place, running on your own machine. Daily prices, one base currency, real money-weighted returns, risk and stress tests, budgets, a full balance sheet with retirement readiness, and Spanish tax tooling. Your data and keys never leave your server.

Python 3.13 FastAPI SQLite / PostgreSQL Docker PDT v2 compatible
localhost:8080 β€” pfm
pfm dashboard: total value, return, cash, progress and risk cards, value history and an allocation donut

What it does

The metrics and tools I actually wanted from a portfolio tracker β€” without handing my financial data to anyone.

πŸ€–

LLM-powered import

Paste any broker statement β€” any language, any format β€” and a model extracts the trades and cash movements. No column mapping. Ready-made importers for IndexaCapital, MyInvestor, Mintos (P2P), Coinbase, Portfolio Dividend Tracker and a generic CSV, plus bank statements (CSV and the Spanish AEB43/N43 format).

🧩

Tracks what you hold

Stocks, ETFs, mutual and index funds, crypto, bonds, commodities, fixed deposits and cash β€” across multiple broker "portfolios", including managed ones such as a robo-advisor β€” plus P2P/savings interest income.

πŸ“ˆ

Real return metrics

Money-weighted IRR, real (inflation-adjusted) return, benchmark comparison, and a return attribution that shows which holdings drove the result and how much came from contributions versus market growth.

βš–οΈ

Risk, stress & exposure

Drawdown, volatility and the Sharpe ratio; stress tests that replay 2008, 2020, 2022 and the dot-com crash on your current holdings; fund look-through to see real sector and region exposure and overlap between funds; position caps that warn when one holding grows too big.

πŸ›’

Spending & budgets

Import bank statements and categorise them with rules, merchant names and AI suggestions. Monthly trends, recurring-charge detection (it flags price rises and missed payments) and named budgets with planned-versus-actual per category.

🏠

Net worth & retirement

A balance sheet with a source and date on every line: broker cash and positions, bank balances, fixed deposits, property, pension and loans with an amortisation schedule. On top of it, a retirement-readiness projection in real terms that includes expected pensions.

🧭

Where the next euro goes

Deployable cash after an emergency buffer and a tax reserve, a "next euro" proposal against your allocation targets with its reasons, and a tax-aware rebalancing plan that prices each sell against its own lots, estimates the tax and can cap the realised gain.

πŸ’Έ

Dividend analytics

Income by month and year, yield-on-cost, projected forward annual income per holding, an income-by-calendar-month view, and fund ongoing charges (TER) in a fees report.

🧾

Spanish income-tax tooling

FIFO realised gains per financial year, a Spanish IRPF savings-base (base del ahorro) estimate, a two-month-rule (antiaplicaciΓ³n) check and a year-end planner for offsetting losses β€” with CSV and PDF exports.

πŸ““

Decisions & action items

A decision journal: what you did, why, what you expected, and a review date to check how it turned out. One Action Items list collects everything that needs attention β€” stale imports, a cap breached, idle cash, a decision due for review.

πŸ’¬

AI chat & research

Ask about your portfolio in plain language; the chat calls live tools over your real holdings, spending, goals and plans. A research workbench adds fundamentals, fair-value and sell calculators and a scorecard of past calls. Works with Anthropic Claude, Gemini, OpenRouter or a local Ollama model.

πŸ”Œ

MCP server

A read-only MCP server exposes holdings, performance, tax, net worth, spending, budget and the allocator to any MCP-capable assistant, such as Claude.

🎯

Goals & simulator

FIRE goals with pace tracking, a Monte-Carlo wealth simulator that fills its inputs from your balance sheet, and saved scenarios you can track against your real net worth.

πŸ”„

PDT & Google Sheets

Full compatibility with Portfolio Dividend Tracker (PDT) v2 β€” a popular dividend tracker that pulls from a handful of brokers or a Google Sheet. pfm reads and writes that same Google Sheet (and the PDT XLSX), so the two stay in sync.

πŸ”’

Private by design

Self-hosted. The code is public; your database, API keys and amounts stay in local, gitignored files that never get committed.

A look inside

Screens from the bundled demo account β€” fictional sample data, not a real portfolio. Click any to enlarge.

Dashboard β€” value, progress, risk, cash and spending at a glance
Net worth β€” balance sheet with a source and date per line, loans, retirement
Spending β€” bank imports, categories, rules and monthly trends
Budget β€” planned versus actual per category
Analytics β€” returns, benchmark and what drove them
Stress test β€” historical crashes replayed on today’s holdings
Research β€” fundamentals, fair value & your position
Action items β€” everything that needs attention, in one list
Decisions β€” a journal of why you bought, sold or held
Holdings β€” live value, cost basis, P&L
Wealth simulator β€” Monte-Carlo (GBM) projection from your own data
Import β€” LLM extraction, broker files, bank statements, PDT, Sheets

Run it yourself

pfm ships with Docker Compose, so a self-hosted instance is a few commands away.

  1. Clone & configureGet the code and create your local secrets (never committed).
  2. Start itOne command brings up the API, web client and database.
  3. Open localhost:8080Log in with your API key, add a portfolio, and import your transactions from a file, pasted text, or a Google Sheet.
# 1 Β· clone + configure
git clone https://github.com/alexgoldhoorn/pfm.git
cd pfm
cp .env.example .env.local
# set SERVER_API_KEY and an LLM key (e.g. ANTHROPIC_API_KEY) in .env.local

# 2 Β· start
docker compose --profile dev up -d --build

# 3 Β· open http://localhost:8080
πŸ’‘ Just want to explore? python scripts/create_demo_account.py --fresh then docker compose -f docker-compose.demo.yml up -d spins up a full demo with fictional sample data (portfolio, bank spending, budget, mortgage) at localhost:8081.

πŸ“– Full documentation   πŸ“ Read the write-up

Built on a documented REST API

Holdings, transactions, imports, analytics, tax reports, spending, budgets, net worth, retirement, the allocator, decisions and Google Sheets sync β€” everything the web client does runs through FastAPI. Browse the full, auto-generated reference.

Open the API reference β†’