Skip to content

Oppizz/opensteuerauszug

 
 

Repository files navigation

OpenSteuerAuszug

VENDORED PACKAGE NOTICE

This is a modified and adapted version of the otiginal opensteuerauszug by vroonhof vroonhof/opensteuerauszug

Main changes:

  • import all broker payments and tax values
  • support for bonds and bond accrued interest (not taxable in Switzerland)
  • option to remove all securities without value at the start end end of tax period and without any taxable payments
  • summarize by currency for easy comparison with IBKR statements
  • etc.

ORGINAL README

A Python package for generating Swiss tax statements (Steuerauszüge) from the statements of brokers that don't support it, e.g. mostly foreign ones. This goal is to eliminate tedious and error prone manual typing into the tax software.

Disclaimer

  • The package is not formally audited
  • the main focus is on getting core transaction and interest data.
  • These need to be verified by the user before submitting with the tax return
  • Tax values are computed best effort for informational purpose (the main Tax software should be able to compute it from the core transaction data.

For more information on required due diligence see the the user guide.

Usage

Main usage case: Generating Steuerauszug from Broker Data

After installing, use the User Guide as the main walkthrough. It covers quick start, preparation steps, broker data export, and complete command examples.

Verifying an Existing Steuerauszug

The tool can also be used to cross check and existing existing Steuerauszug (eCH-0196 XML). See See verify instructions.

Appending Additional Documents

You can attach original broker statements or other supporting documents to the generated PDF using --pre-amble and --post-amble options. See the User Guide for details.

Features

  • Import broker data provide transaction and position data in ECH-0196 compliant format.
  • Perform simple tax approximations for informational purposes.
  • Cross verify calculations against existing E-Steuerauszug data
  • Create standardized formatted PDF that can be imported into Tax Software.
  • Append original supporting documents to the final PDF.

Sample Output

Below are previews from a sample Steuerauszug generated from the VT and Chill IBKR test data.

Summary page (p.1) Stock table (p.3)
Summary page Stock table

📄 Download full sample PDF

📄 Download full sample ECH-0196 XML

Supported Brokers

For now the focus is on brokers / banks that the author has

  • Charles Schwab (main trading account and Equity Awards)
  • Interactive Brokers

Additionally we can recalculate and verify any existing steuerauszug (this is mostly to increase confidence in the software itself)

Related work and alternatives

Datalevel offers a very similar solution for IBKR as a paid service (reasonable yearly flat fee). It is a SaaS solution that requires online access to the flex API for your account. They are from the Swiss banking ecosystem so they use the shared Java rendering libraries which makes things look a bit more standard. They suffer from of the same issues as well, like this project they are not actually the official bank. If you need no hassle, this could be it.

zh-tax-csv-import is a chrome extension also imports Schwab and Interactive Broker statements, but then fills in directly on the tax forms. This is less clean and more brittle, but once done the Tax office sees no difference to manual entry. As an upside the tax declaration remains an authoritative list of all your investments and accounts.

Agentic browsers are getting very close just be able to do the above all by themselves.

The EWV and SSK publish a shared set of tools that is even referenced in the spec. This used to available online, but is now locked down to a cabal of banks and tax officials. Inquiring minds however have noticed that the JAR is included in nearly every offline official Tax software. It includes an official sample renderer for the PDF version given an XML file, so you could also use that instead of the python renderer. It will look a bit more official. I wasn't aware this existed and had to reconstruct from scratch as well as fix a lot of the python PDF417 libraries. The spec refers to the library as open source but non of these actually include the source.

Installation

Quick install (recommended for users)

One-time install of the CLI via uv

uv tool install --from git+https://github.com/vroonhof/opensteuerauszug.git opensteuerauszug

# Then run normally (without pixi, or after . ./scripts/setup_pixi.sh)
opensteuerauszug --help

Install uv first: https://docs.astral.sh/uv/getting-started/installation/

uv can also install/manage Python for you, so you usually do not need a separate Python setup step.

For one-off runs without installing the tool, you can also use:

uv run --with git+https://github.com/vroonhof/opensteuerauszug.git opensteuerauszug --help

Then continue with the User Guide.

Development install [option 1] (contributors: using python venv)

For development and tests, install from source:

git clone https://github.com/vroonhof/opensteuerauszug.git
cd opensteuerauszug
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e ".[dev]"
pip install git+https://github.com/vroonhof/pdf417decoder.git#subdirectory=python

Development install [option 2] (contributors: using pixi)

git clone https://github.com/vroonhof/opensteuerauszug.git
cd opensteuerauszug
. ./scripts/setup_pixi.sh

Verifying the generated XML

When you export the final XML using --xml-output, you can validate it against the official eCH-0196 schema with common XML tools. Examples:

# Using libxml2
xmllint --noout --schema specs/eCH-0196-2-2.xsd output.xml

# Using a Java based validator (Jing)
java -jar jing.jar specs/eCH-0196-2-2.xsd output.xml

Scripts and Tools

This project includes various scripts for data processing, testing, and utility tasks. For detailed documentation on available scripts, including the Kursliste filtering tool, see the Scripts Readme.

Development

Setup

To set up the development environment (venv):

# Create and activate virtual environment
python -m venv .venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -e ".[dev]"

To set up the development environment (pixi):

. ./setup_pixi.sh

Testing

pytest tests/

If the environment variable EXTRA_SAMPLE_DIR points to a directory with XML files these are validated as part of a set of integration sets. See the verify documentation for how to invoke that manually.

Developer Scripts

This project includes utility scripts for development and data management. For detailed information on these scripts, please see the Scripts Documentation.

Code quality and AI usage.

This project exists in part for me to try out AI based coding outside of $WORKPLACE to try out various tools. As a result code quality and style is inconsistent and contains various AIisms. Code has been cleaned-up, reviewed and controlled by me where it matters.

That said all mistakes, hallucinations etc are probably mine.

Related projects

Acknowledgements

Many thanks to everyone who has tested this tool with their own data and contributed fixes and improvements.

Special thanks to @pet-zh, whose extensive real-world testing and numerous fixes have made the output significantly more polished and reliable.

License

See LICENSE file.

Though I am not formally requiring it to keep things simple, I would prefer if you dropped me a line if this package being used or included in other software or other service (e.g. if you are financial service provider).

About

Tool to generate swiss e-steuerauszug from banking exports

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.5%
  • Other 0.5%