The problem
The broker shows a balance. It does not show a time-weighted return, what deposits and withdrawals did to that number, or what the same portfolio would have cost in tax under a different account type.
Approach
The official API is closed to private customers. So the CSV export is the input: everything is derived from my own exported trades, nothing is scraped, and nothing logs in on my behalf.
What it does
Imports and normalises trades, computes a time-weighted return, shows allocation, forecasts the portfolio, compares account wrappers against Danish 2026 tax rules, reconciles against the broker’s own figures and exports the result.
Where it stands
Runs in Docker on my own server, with one user: me. It is an experiment in owning your own numbers, not a product, and it is not advice to anyone.
What I learned
That the maths was not the hard part. The hard part was agreeing with the broker on what a position even is, once currency, fees and partial sales have been through it.