| data | ||
| docker | ||
| docs | ||
| networth_web | ||
| .env.example | ||
| .gitignore | ||
| AGENTS.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| dump-balances.py | ||
| dump-periods.py | ||
| Justfile | ||
| LICENSE | ||
| networth_ddl.sql | ||
| populate-database.py | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
Net Worth
I'm building a simple database backed web application to keep track of my Net Worth. The purpose of this application is to track the value of my investments over time and to provide analysis of this data using suitable graphs and dashboards.
This will/should be made obsolete if I ever get my Gnucash clone working - see ``~/Work/code/personal_wealth`
Data Model
See docs/data-model.md for the canonical database-agnostic definition. The SQL source of truth is networth_ddl.sql.
Period
This is a day, week, month, quarter or year. Should act like a dimension in a star schema with the difference that I want to be able to choose which level to assign values (see balances) to.
The data will be organised in a tree like structure. Each record can have one (and only one) parent. Any record without a parent is the top of a hierarchy. Within a year we can have quarters, within quarters we have months and days.
Weeks are a seperate hierarchy, each one is in a year but because they can span months and/or quarters we keep them seperate.
This table is static and should be populated using a script. The script will be run once for each year to create the appropriate week, month, quarter and year records. Daily records will only be created as needed.
The periods table should be part of the seed data used to create a new database containing weeks, months and quarters for the current calendar year.
Account
Accounts will have a type, one of
- Bank account
- Stock holding
- Investment account
- Credit Card
- Loan
- Mortgage
These account types have a further attribute indicating if they are a credit or debit type of account.
The account types table data should be part of the seed data used to create a new database
Balance
Foreign keys to both account and period. For stock holdings, quantity holds the number of units held.
Balances should be editable in the application, with users able to add or amend balance records. If an account is a stock holding we should be able to run a script to fetch and update the stock price from the internet. This script should either be run periodicially or invoked from the application.
Application
A simple, web based application. The main purpose (and the initial view) is to view net worth (sum of all balances) over time, with a switch to choose between different period types and ranges. The initial state of this dashboard should show sums of debits and credits by week for each of the last 2 months.
Reference data (accounts, account types, and periods) is managed through the Django Admin interface at /admin/.
There will be utilities to
- fetch the price for stocks to populate the balance for a stock holding. Do we keep the stock prices in a seperate table? The utility should be able to fetch the current price for a stock or to get prices for a historical range and should upsert the prices so it can be used to fill any gaps in historical prices.
- fetch balances for bank accounts from bank APIs (probably only Up Bank for now)