Skip to main content

Personal Finance ETL logo

Personal Finance ETL

Local-first financial systems engineering for evidence, accounting, analytics, tax, wealth, and FIRE.

From fragmented financial evidence to reconciled, explainable financial truth.

PyPI Python GPL-3.0-or-later Polars DuckDB SQLite CustomTkinter


Contents


Why PFETL exists

Personal finance data is rarely difficult because there is too little of it.

It is difficult because the evidence is fragmented, provider-shaped, historical, multi-currency, and financially ambiguous.

I built Personal Finance ETL (PFETL) as my own local financial systems platform to solve that problem properly.

PFETL ingests household records, investment statements, reference data, market prices, benchmark histories, FX evidence, and financial assumptions; preserves what was actually observed; reconstructs canonical financial state; reconciles that state against external evidence; and publishes decision-ready analytical datasets.

The system is designed to answer questions such as:

What evidence did I receive? What does it mean financially? What state follows from it? Does that state reconcile? Which assumptions produced it? Can I explain the result later?

That makes PFETL more than an ETL pipeline.

It is the financial truth engine underneath my personal analytics ecosystem.

Everything runs locally.


The PFETL ecosystem

PFETL now has two deliberately separate products:

PFETL
├── Core
│   ├── ingest
│   ├── normalize
│   ├── reconstruct
│   ├── calculate
│   ├── reconcile
│   ├── preserve evidence
│   └── publish financial truth
│
└── Analytics Studio
    ├── explore
    ├── compare
    ├── visualize
    ├── drill
    ├── diagnose
    ├── report
    └── export

The boundary is intentional:

Core owns truth. Analytics Studio owns interpretation and presentation.

PFETL Analytics Studio: GitHub · PyPI

Core does not contain analytical dashboards.

Studio does not reimplement FIFO, tax methodology, XIRR, FX attribution, reconciliation, or FIRE calculations.

The two applications communicate through explicit local contracts:

Settings TOML
FinancialRules TOML
DuckDB
Control Plane SQLite
Forensic JSONL
pipeline.lock
process launch
/healthz
runtime metadata

The system in one view

flowchart LR
    subgraph EVIDENCE["Financial Evidence"]
        HH["Household SQLite"]
        INV["Broker / Investment Statements"]
        REF["Reference Data"]
        MKT["Market / Benchmark / FX"]
    end

    subgraph CORE["PFETL Core"]
        RAW[("Raw Store")]
        CP[("SQLite Control Plane")]
        B[("Bronze · 20")]
        S[("Silver · 24")]
        FIN["Financial Engines\nFIFO · Tax · Wealth · FIRE"]
        G[("Gold · 22")]
        OBS["Observability + Recovery"]
    end

    subgraph SURFACES["Operator & Analytical Surfaces"]
        CLI["pfetl CLI"]
        GUI["CustomTkinter Operator Console"]
        STUDIO["PFETL Analytics Studio"]
        BI["Power BI / SQL Consumers"]
    end

    HH --> RAW
    INV --> RAW
    REF --> RAW
    MKT --> RAW

    RAW --> CP
    CP --> B
    B --> S
    S --> FIN
    FIN --> G

    CP --> OBS
    FIN --> OBS

    G --> CLI
    G --> GUI
    G --> STUDIO
    G --> BI
    CP --> STUDIO
    OBS --> GUI
    OBS --> STUDIO

PFETL separates several kinds of authority:

Layer Question
Observed evidence What files, records, prices, mappings, and parameters did the system actually receive?
Canonical financial state What do those observations mean in one consistent financial vocabulary?
Reconstructed state What holdings, lots, valuations, tax events, and balances follow from that evidence?
Reconciliation evidence Where does reconstructed state disagree with external observation?
Operational truth What happened during a run, what changed, what failed, and how can it be reconstructed?
Decision surface Which stable analytical marts should downstream consumers use?

Gold is a decision surface, not a second source of truth.


Financial capabilities

Household finance

PFETL reconstructs household financial activity across accounts and asset groups.

Capabilities include:

  • income, expense, and transfer classification;
  • active vs passive income;
  • core vs non-core expense;
  • operating, investing, and financing cashflow;
  • opening-balance reconstruction;
  • account and asset state;
  • savings and investment rates;
  • income resilience;
  • expense-growth analysis;
  • liquidity and runway;
  • net-worth movement and attribution.

Household finance is treated as a ledger problem first and an analytics problem second.


Investment accounting

The investment engine reconstructs portfolio state from transaction evidence rather than relying only on broker snapshots.

It supports:

  • deterministic transaction identities;
  • chronological FIFO lot matching;
  • partial lot depletion;
  • remaining cost basis;
  • realized gain/loss events;
  • open-lot analytics;
  • broker quantity reconciliation;
  • market valuation;
  • portfolio weights;
  • concentration;
  • instrument/class/sector/industry/geography/country/currency views.

Lot-level state remains traceable to the evidence that created it.


Performance, benchmark, and FX

PFETL separates portfolio performance into economically meaningful components.

Measures include:

  • invested value;
  • market value;
  • absolute return;
  • CAGR;
  • XIRR;
  • after-tax XIRR;
  • benchmark XIRR;
  • active return;
  • maximum drawdown;
  • asset P&L;
  • FX P&L;
  • FX contribution;
  • local-currency valuation;
  • base-currency valuation;
  • concentration using Top-N, HHI, and effective holdings.

A multi-currency portfolio therefore remains explainable instead of collapsing into one final return number.


Tax evidence

Tax is a first-class financial domain.

PFETL derives and publishes:

  • holding-period classification;
  • realized tax events;
  • STCG / LTCG treatment;
  • tax heads and sub-heads;
  • exemption-aware analytical treatment;
  • indicative tax-if-sold estimates;
  • unrealized LTCG / STCG exposure;
  • harvesting signals;
  • LTCG maturity ladders;
  • financial-year summaries;
  • tax reconciliation evidence.

Tax outputs are analytical evidence and planning support, not statutory filing advice.


Wealth and FIRE

PFETL combines household and investment state into long-horizon financial planning.

Capabilities include:

  • market and book net worth;
  • net-worth change attribution;
  • wealth composition;
  • liquidity and emergency coverage;
  • FI targets;
  • Coast FI;
  • target-age analysis;
  • required savings/investment rates;
  • wealth velocity;
  • deterministic FIRE projections;
  • Monte Carlo simulation;
  • percentile outcomes;
  • success probabilities;
  • configurable return, inflation, and planning assumptions.

Financial methodology lives in FinancialRules, not scattered hardcoded literals.


Data architecture

PFETL uses a local medallion-style analytical warehouse with finance-specific ownership.

Bronze · 20 source contracts

Bronze preserves normalized source evidence and provenance.

It covers source-oriented financial datasets including household records, investment statements, reference data, opening balances, market evidence, benchmarks, and FX.

Bronze stays close to evidence.

Silver · 24 canonical contracts

Silver represents canonical financial state.

It contains dimensions and facts for:

  • calendar and financial year;
  • household categories and assets;
  • canonical transactions;
  • opening balances;
  • investments;
  • market and benchmark evidence;
  • acquisition lots;
  • realized events;
  • reconciliation events;
  • tax events.

Silver is where provider-shaped evidence becomes PFETL-shaped finance.

Gold · 22 analytical marts

Gold publishes decision-oriented analytical surfaces spanning:

  • household finance;
  • monthly cashflow;
  • budget;
  • wealth;
  • FIRE;
  • portfolio summary;
  • allocation;
  • investment performance;
  • tax.

Gold is optimized for read-only downstream consumption by Power BI, SQL tools, and PFETL Analytics Studio.


Control Plane and evidence

PFETL does not treat execution as a black box.

A dedicated SQLite Control Plane tracks operational truth including:

  • run lifecycle;
  • commit state;
  • artifact discovery;
  • source synchronization;
  • immutable payload history;
  • source change events;
  • provider requests;
  • failures;
  • configuration snapshots;
  • FinancialRules snapshots;
  • simulation provenance;
  • sync summaries;
  • recovery state.

A historical run can therefore answer not only:

What did the pipeline produce?

but also:

Which evidence, configuration, financial rules, provider calls, and execution path produced it?


Observability and recovery

PFETL uses one structured observability path with multiple downstream consumers.

flowchart TD
    APP["Application · Domain · Workers"]
    EMIT["Structured Observability Emitter"]
    UI["User Narrative\nCLI + Desktop"]
    JSONL["Forensic JSONL\nStructured lineage"]
    CP["Control Plane\nDurable run metadata"]

    APP --> EMIT
    EMIT --> UI
    EMIT --> JSONL
    EMIT --> CP

Events can carry context such as:

  • run ID;
  • stage;
  • component;
  • operation;
  • parent operation;
  • entity identity;
  • duration;
  • rows;
  • provider;
  • attempt;
  • cache state;
  • worker/batch;
  • commit state;
  • Settings/Rules fingerprints;
  • structured exception information;
  • remediation hints.

Multiprocessing workers feed the same observability architecture through queue sinks.

There is no second worker logging universe.

Recovery capabilities include:

  • coordinated database snapshots;
  • restore;
  • recovery-required state;
  • run-state inspection;
  • retained evidence;
  • operator diagnostics.

Configuration and FinancialRules

PFETL separates operational configuration from financial methodology.

Settings

Settings own operational facts such as:

  • source paths;
  • database locations;
  • observability retention;
  • worker counts;
  • DuckDB threads;
  • provider retry behavior;
  • market-data windows;
  • staleness policies.

FinancialRules

FinancialRules own methodology and assumptions such as:

  • tax treatment;
  • expense analytics;
  • income grouping;
  • portfolio tolerances;
  • FIRE assumptions;
  • inflation and return assumptions;
  • Monte Carlo parameters;
  • target allocations;
  • LTCG maturity rules.

The rule is:

If an assumption can reasonably change without changing the algorithm, it belongs in configuration, not hardcoded Python.

Both models are typed, validated, and editable through the Core desktop UI.


Operator surfaces

PFETL exposes one product command:

pfetl

and two operator experiences:

CLI
+
CustomTkinter Desktop

The Core UI deliberately focuses on operating the financial engine.

It is not an analytics dashboard.


Pipeline Run

The Run workspace provides:

  • active Settings profile;
  • active FinancialRules profile;
  • pipeline launch;
  • progress;
  • live narrative;
  • snapshot;
  • restore;
  • operation interlocking;
  • truthful runtime status;
  • Analytics Studio lifecycle controls.

Pipeline execution remains outside Tk's main thread/process interaction path.


Configuration

The desktop UI provides structured editors for:

Settings
FinancialRules

The editors are driven by typed Pydantic metadata and support:

  • recent profiles;
  • browse;
  • reload;
  • validation;
  • Save;
  • Save As;
  • dirty-state protection;
  • inline validation feedback;
  • atomic TOML writes;
  • preservation of TOML comments/order.

Changing financial assumptions no longer requires editing Python.


Logs

The Logs workspace separates three concepts:

PFETL Live Narrative
PFETL Forensic JSONL
Analytics Studio Process

Live Narrative

A user-facing execution story projected from structured Core events.

Forensic JSONL

Historical structured event inspection with:

  • cached background parsing;
  • search;
  • filters;
  • pagination;
  • event detail;
  • lineage;
  • errors;
  • remediation context.

Analytics Studio Process

Bounded stdout/stderr from the supervised Studio child process.

Studio process output is not injected into PFETL's canonical forensic JSONL.


System & Health

System inspection includes:

  • pipeline lock;
  • DuckDB health;
  • Raw Store health;
  • Control Plane health;
  • latest run;
  • recovery state;
  • warehouse inventory;
  • active paths;
  • application/runtime information;
  • actionable Doctor diagnostics.

Blocking inspection work runs asynchronously from Tk.


Analytics Studio integration

Analytics Studio: GitHub · PyPI

PFETL Core can supervise the separately installed PFETL Analytics Studio server directly from the desktop application.

This integration is intentionally process-based.

sequenceDiagram
    participant U as User
    participant C as PFETL Core
    participant S as Studio Server
    participant B as Browser

    U->>C: Start Studio
    C->>C: Validate active Settings + FinancialRules
    C->>S: Launch server process with active profile
    S-->>C: Runtime metadata
    C->>S: GET /healthz
    S-->>C: ready
    C->>B: Open resolved Studio URL
    U->>C: Stop / Restart
    C->>S: Terminate owned process

Core passes the exact active:

Settings TOML
FinancialRules TOML

to Studio.

No profile reselection is required.

If the active Core profile changes while Studio is running, Core marks:

Restart required

rather than attempting unsafe live cross-process mutation.


Studio lifecycle controls

Core exposes:

Start Studio
Open
Restart
Stop
Logs

with states such as:

Stopped
Starting
Ready
Stopping
Failed
Restart required

Readiness is determined by Studio's /healthz, not merely by an open port.

Core captures Studio stdout/stderr through background readers and projects it into the existing bounded Tk log architecture.


Studio discovery

Studio is intentionally not required to be embedded inside the Core executable.

Core can resolve a launchable Studio installation through supported paths such as:

  • user-selected standalone executable;
  • global pfetl-studio-server / Studio CLI;
  • installed Python environment/module;
  • sibling development repository;
  • optional bundled distribution path where available.

This keeps both products independently releasable.


Pipeline coexistence

Core does not kill Studio when the financial pipeline starts.

Studio already respects PFETL's pipeline.lock and avoids unsafe analytical reads while Core is publishing.

The Core UI can therefore show:

Studio Ready · Analytics locked

during pipeline execution.


Reliability model

PFETL is designed to fail visibly rather than silently.

Safeguards include:

  • deterministic identities;
  • typed contracts;
  • schema validation;
  • explicit reconciliation;
  • Control Plane run states;
  • immutable configuration/rules provenance;
  • controlled publication;
  • recovery detection;
  • snapshots and restore;
  • bounded observability;
  • source-hash tracking;
  • artifact history;
  • process supervision;
  • health checks.

The goal is not:

never fail.

It is:

Know what happened, preserve the evidence, protect financial truth, and recover deliberately.


Testing philosophy

The test suite is intentionally compact and financially meaningful.

It focuses on production confidence rather than preserving historical refactor-phase tests.

Coverage includes:

  • full pipeline execution from Control Plane through Gold;
  • household ledger identities;
  • income, expense, cashflow, and balances;
  • FIFO lot depletion;
  • deterministic lot identities;
  • realized gains;
  • remaining cost basis;
  • tax classification;
  • FX attribution;
  • benchmark attribution;
  • wealth and FIRE outputs;
  • deterministic simulation behavior;
  • operational integrity;
  • Settings and FinancialRules round-trips;
  • forensic-log behavior;
  • System/Doctor behavior;
  • Analytics Studio lifecycle integration.

Example FIFO golden case:

Buy 100 @ ₹100
Buy  50 @ ₹120
Sell 120 @ ₹150

FIFO
├── Lot 1: 100 disposed
├── Lot 2: 20 disposed
├── Remaining quantity: 30
└── Remaining basis: ₹3,600

The tests assert actual money, quantities, identities, and classifications rather than merely checking that a class exists.


Technology stack

Area Technology
Language Python 3.13+
Compute Polars
Analytical warehouse DuckDB
Control Plane / Raw Store SQLite
Validation / configuration Pydantic
TOML preservation tomlkit
Excel ingestion fastexcel
XIRR pyxirr
Numerical acceleration Numba
Market evidence yfinance
Desktop CustomTkinter
Terminal UX Rich
Concurrency multiprocessing + worker queues
Studio supervision subprocess + psutil + /healthz
Packaging Hatchling + PyInstaller
Quality Ruff · Mypy · Pyright · Pylint · Pytest

Installation

PFETL requires Python 3.13+.

PyPI

pip install personal-finance-etl
pfetl

From source

git clone https://github.com/tks18/personal-finance-etl.git
cd personal-finance-etl

uv sync
uv run pfetl

PFETL is local-first.

Financial sources, databases, logs, and analytical state remain on the local machine.


CLI

# Desktop
pfetl

# Explicit GUI
pfetl --gui

# Complete pipeline
pfetl run --config config.toml --rules rules.toml

# Unattended execution
pfetl run --config config.toml --rules rules.toml --cron

# Operational status
pfetl status --config config.toml

# System / warehouse information
pfetl info --config config.toml

# Actionable diagnostics
pfetl doctor --config config.toml --rules rules.toml

# Snapshot
pfetl snapshot --config config.toml

# Restore
pfetl restore backup_archive.zip --config config.toml

# Version
pfetl --version

The desktop can additionally supervise Analytics Studio using the active Settings and FinancialRules profile.


Repository architecture

src/personal_finance_etl/
├── application/       # orchestration and use cases
├── bootstrap/         # dependency composition
├── config/            # Settings + FinancialRules
├── contracts/         # typed cross-boundary contracts
├── domain/            # financial meaning and algorithms
├── infrastructure/    # stores, providers, observability, recovery, Studio process
└── presentation/      # CLI + CustomTkinter

Ownership model:

application
→ what workflow runs?

bootstrap
→ how are concrete dependencies assembled?

config
→ what runtime and financial policy is valid?

contracts
→ what crosses boundaries?

domain
→ what does the finance mean?

infrastructure
→ how are persistence, I/O, recovery and child processes implemented?

presentation
→ how does a human operate and inspect the system?

What this project demonstrates

PFETL sits at the intersection of finance, accounting, data engineering, quantitative analytics, software architecture, reliability engineering, and product engineering.

Finance & accounting

  • household financial reconstruction;
  • investment accounting;
  • FIFO;
  • realized / unrealized P&L;
  • multi-currency attribution;
  • benchmark analysis;
  • tax evidence;
  • wealth;
  • FIRE.

Data engineering

  • heterogeneous ingestion;
  • deterministic transformations;
  • medallion warehouse design;
  • typed contracts;
  • DuckDB analytical modelling;
  • SQLite operational metadata;
  • source lineage;
  • artifact history;
  • incremental synchronization.

Software engineering

  • object-oriented design;
  • typed interfaces;
  • dependency composition;
  • multiprocessing;
  • deterministic identity;
  • recovery semantics;
  • structured observability;
  • CLI;
  • desktop UI;
  • child-process supervision;
  • packaging.

Quantitative analytics

  • XIRR / CAGR;
  • benchmark-relative performance;
  • FX decomposition;
  • concentration;
  • cashflow and wealth attribution;
  • deterministic and stochastic FIRE;
  • Monte Carlo simulation.

Product engineering

  • local-first privacy;
  • operator-focused UX;
  • configurable methodology;
  • typed configuration editors;
  • production-confidence golden tests;
  • actionable diagnostics;
  • Analytics Studio orchestration.

This project is where my background as a Chartered Accountant and my work across analytics, data engineering, and software engineering converge into one system.

Finance gives me the questions. Data gives me the structure. Software engineering lets me build the answers.


Design principles

  1. Financial correctness gets complexity.
  2. Operational reliability gets complexity.
  3. Recurring manual friction may earn complexity.
  4. Extensibility by itself is not a product requirement.
  5. Configuration owns assumptions; code owns algorithms.
  6. Observed evidence is preserved before interpretation.
  7. Reconciliation is better than silent agreement.
  8. One operational event should feed every Core presentation.
  9. Derived state should be rebuildable.
  10. Analytics belongs downstream from canonical truth.
  11. Mature systems should become boring to operate.

Project maturity

PFETL is built primarily for my own financial workflow.

That is an intentional product constraint.

It optimizes for:

correctness
over
generic onboarding

explainability
over
black-box automation

local control
over
cloud dependence

maintainability
over
architecture for architecture's sake

real monthly usefulness
over
hypothetical breadth

Core is now in steady-state engineering.

Future changes should originate from:

  • a genuine financial-rule change;
  • a provider/source change;
  • an observed bug;
  • a concrete operating friction;
  • an upstream/downstream compatibility requirement.

Not from another architecture program.

The reactor works.

Please stop redesigning the reactor. 😂⚛️


Author

Shan

Chartered Accountant × Data & Software Engineer

PFETL began as a way to consolidate my own finances.

It became a financial systems engineering project spanning evidence, accounting, data engineering, quant, tax, reliability, observability, desktop product engineering, and analytical consumption.

Built locally. Auditable end to end. Designed to explain the numbers, not merely display them.


License

Licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later).

See LICENSE.

Metadata

Release files for personal-finance-etl 12.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for personal-finance-etl 12.2.0
File Size Uploaded Provenance Actions
personal_finance_etl-12.2.0.tar.gz 1.0 MB With provenance Details for personal_finance_etl-12.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for personal-finance-etl 12.2.0
File Interpreter ABI Platform Actions
personal_finance_etl-12.2.0-py3-none-any.whl Python 3 none any Details for personal_finance_etl-12.2.0-py3-none-any.whl

Total release size: 1.9 MB

Release files / personal_finance_etl-12.2.0.tar.gz

Download URL personal_finance_etl-12.2.0.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
cfdd286cb826e7bcc9e4c9b9f20f33814c5aab5bf0a850305bd08548766ea0e2
BLAKE2b-256 checksum
How to use checksums
5fbf766a8a94c70da3155b19b606acc7dac652231cce451428f783ef1b09e57f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / personal_finance_etl-12.2.0-py3-none-any.whl

Download URL personal_finance_etl-12.2.0-py3-none-any.whl
Size 880.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a62a8d33f493a20f196f8ce99c5a0ba53f680af0c926812647e74bd84643258b
BLAKE2b-256 checksum
How to use checksums
d39e3935bb570261e137aa370a146592803bd65ebe5e64fbebdd90e34a283c26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for personal-finance-etl 12.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for personal_finance_etl-12.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

12.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page