The Analytic Companion for Portfolio Performance
Project description
pp-terminal - The Analytic Companion for Portfolio Performance
A powerful command-line tool that uses the openness of Portfolio Performance data and the convenient access of ppxml2db to offer a whole new level of insights into your portfolio.
For example, pp-terminal includes a command to calculate the preliminary tax values ("Vorabpauschale") for Germany:
pp-terminal is a lightweight tool for all the nice-to-have features that won't make it into the official Portfolio Performance app. This can be because of country-dependant tax rules, complex Java implementation, highly individual requirements, too many edge-cases, etc.
[!IMPORTANT] I am not a tax consultant. All results of this application are just a non-binding indication and without guarantee. They may deviate from the actual values.
Commands
Code completion for commands and options is available.
You can choose between different output formats like JSON or CSV with the --format option.
In addition to the standard set, you can easily create your own commands and share them with the community.
By default, pp-terminal --help provides the following commands:
Inspect Portfolio
| Command | Description |
|---|---|
view accounts |
Get detailed information about the balances per each deposit and/or securities account |
view securities |
Get detailed information about the securities |
The commands can be customized in the configuration file:
[commands.view.accounts]
columns = ["AccountId", "Name", "Balance"]
[commands.view.securities]
columns = ["SecurityId", "Name", "Shares"]
Simulate Scenarios
| Command | Description |
|---|---|
simulate interest |
Calculate how much interest you should have been earned per account and compare with actual values |
simulate share-sell |
Calculate gains and taxes if a security would be sold (based on FIFO capital gains) |
simulate vorabpauschale |
Run a simulation for the German preliminary tax ("Vorabpauschale") on the portfolio |
Validate Data
| Command | Description |
|---|---|
validate |
Run all validation checks on the portfolio data |
validate accounts |
Run configured accounts validations, e.g. balance limits |
validate securities |
Run configured security validations, e.g. prices up-to-date |
The commands can be customized in the configuration file:
# Note: order of rules is relevant
[[commands.validate.accounts.rules]]
type = "balance-limit"
value = 25000
applies-to = ["c9c57e01-7ea0-4e70-bed9-4656941f7687"]
[[commands.validate.accounts.rules]]
type = "balance-limit"
value = 100000
[[commands.validate.accounts.rules]]
type = "date-passed-from-attribute"
value = "fgdeb0dd-8bd7-47b1-ac3f-30fedd6a47e9"
[[commands.validate.securities.rules]]
type = "price-staleness"
value = 90
[[commands.validate.securities.rules]]
type = "price-staleness"
severity = "warning"
value = 30
Export
| Command | Description |
|---|---|
export anonymized |
Save an anonymized version of the Portfolio Performance XML file |
The command can be customized in the configuration file:
[commands.export.anonymized.attributes."a1b2c3d4-e5f6-7890-abcd-ef1234567890"]
provider = "iban"
[commands.export.anonymized.attributes."fgdeb0dd-8bd7-47b1-ac3f-30fedd6a47e9"]
provider = "pyfloat"
args = { min_value = 0.0, max_value = 1.0, right_digits = 2 }
Requirements
- pipx to install the application (without having to worry about different Python runtimes)
- Portfolio Performance version >= 0.70.3
- Portfolio Performance file must be saved as "XML with id attributes"
Installing
pipx install pp-terminal
Once installed, update to the latest with:
pipx upgrade pp-terminal
Usage 💡
Portfolio Performance XML File
[!TIP] The application does not modify the original Portfolio Performance file and works completely offline.
All commands require the Portfolio Performance XML file as input.
You can either provide that file as first option to the command
pp-terminal --file=depot.xml view accounts
or use a configuration file (see below).
To view all available arguments you can always use the --help option.
Configuration File
To persist the CLI options you can pass a configuration file with pp-terminal --config=config.toml --help.
The TOML format supports comments and is more readable than JSON for complex configurations.
file = "portfolio_performance.xml"
precision = 4
[tax]
rate = 26.375
file = "vorabpauschale.csv"
exemption-rate = 30
exemption-rate-attribute = "b3c38686-2d22-4b5d-8e38-e61dcf6fdde3"
Customize Number Formats
If you want another formatting for numbers, assure that the terminal has the correct language settings, e.g. for Germany
set environment variable LANG=de_DE.UTF-8.
Disable Colored Output
To disable all colors in the console output for a better readability, you can set the NO_COLOR=1 environment variable.
Contributing
Propose Changes
To contribute improvements to pp-terminal just follow these steps:
- Fork and clone this repository
- Run
make - Verify build with
poetry run pp-terminal --version - Create a new branch based on
master:git checkout master && git pull && git checkout -b your-patch - Implement your changes in this new branch
- Run
maketo verify everything is fine - Submit a Pull Request
Create Your Own Command ⚒️
Developers can easily extend the default pp-terminal functionality by implementing their own commands. Therefore, the Python
entry point pp_terminal.commands is provided.
To hook into a sub-command, e.g. view, you have to prefix the entry point name with view..
The most basic pp-terminal command looks like this:
from pp_terminal.output import Console
import typer
app = typer.Typer()
console = Console()
@app.command
def hello_world() -> None:
console.print("Hello World")
This will result in the command pp-terminal hello-world being available.
For more sophisticated samples take a look at the packaged commands in the pp_terminal/commands directory,
e.g. a good starting point is view_accounts.py.
The app uses Typer for composing the commands and Rich for nice console outputs. The Portfolio Performance XML file is read with ppxml2db and efficiently held in pandas dataframes.
If your command makes sense for a broader audience, I'm happy to accept a pull request.
Known Limitations 🚧
- The script is still in beta version, so there might be Portfolio Performance files that are not compatible with and also public APIs can change
License
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pp_terminal-0.7.0.tar.gz.
File metadata
- Download URL: pp_terminal-0.7.0.tar.gz
- Upload date:
- Size: 68.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20c3520e0956732681d4cb497936dc44f7d2eb818c343404c36762ce0a358ce7
|
|
| MD5 |
91e40d7c2069f3b5fb33a4844e2db937
|
|
| BLAKE2b-256 |
07c6d5d229c498acb78fcfc045673c1f8db860c91aa84ca072ab55795f45910d
|
Provenance
The following attestation bundles were made for pp_terminal-0.7.0.tar.gz:
Publisher:
ci.yml on ma4nn/pp-terminal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pp_terminal-0.7.0.tar.gz -
Subject digest:
20c3520e0956732681d4cb497936dc44f7d2eb818c343404c36762ce0a358ce7 - Sigstore transparency entry: 855000376
- Sigstore integration time:
-
Permalink:
ma4nn/pp-terminal@db28e3e3fc4a471ea22af41355e390c886b56636 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/ma4nn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@db28e3e3fc4a471ea22af41355e390c886b56636 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pp_terminal-0.7.0-py3-none-any.whl.
File metadata
- Download URL: pp_terminal-0.7.0-py3-none-any.whl
- Upload date:
- Size: 104.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05256e2c6d99ca752dce366d2c1f47566b891e6c80b54359f35d39b0b6f0f14c
|
|
| MD5 |
e97ca91c024ca1d5e50c322716fd00df
|
|
| BLAKE2b-256 |
cee35f1791ca8c1d42cf3e0b582a3f8c834672c3d4d8bab257ed7f5d45b1c700
|
Provenance
The following attestation bundles were made for pp_terminal-0.7.0-py3-none-any.whl:
Publisher:
ci.yml on ma4nn/pp-terminal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pp_terminal-0.7.0-py3-none-any.whl -
Subject digest:
05256e2c6d99ca752dce366d2c1f47566b891e6c80b54359f35d39b0b6f0f14c - Sigstore transparency entry: 855000380
- Sigstore integration time:
-
Permalink:
ma4nn/pp-terminal@db28e3e3fc4a471ea22af41355e390c886b56636 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/ma4nn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@db28e3e3fc4a471ea22af41355e390c886b56636 -
Trigger Event:
release
-
Statement type: