Skip to content

About

Tool to generate swiss e-steuerauszug from banking exports

Resources

Stars

372 stars

Watchers

7 watching

Forks

Repository files navigation

OpenSteuerAuszug

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.
  • The standalone web app's browser wizard is a separate, mostly AI-coded UI layer and has seen much less real-world testing than the Python/CLI version. Prefer the CLI if you can install it.

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

Thanks to community contributions we also support

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

Standalone web app (no installation)

OpenSteuerAuszug also runs as a single HTML page in your browser — open https://vroonhof.github.io/opensteuerauszug/ and a wizard guides you through the steps (or save the page locally and open it from disk). Your financial data never leaves your computer. See the web app guide for details.

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 uv)

For development and tests, install from source:

git clone https://github.com/vroonhof/opensteuerauszug.git
cd opensteuerauszug
uv sync --locked --extra dev

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 locked development environment with uv:

uv sync --locked --extra dev

To set up the development environment (pixi):

. ./setup_pixi.sh

Testing

uv run --locked --extra dev pytest tests/

To update all dependencies and regenerate both the uv-specific and standard PEP 751 lock files:

./scripts/update_lockfiles.sh --upgrade

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.

The standalone web app is a particularly heavy case: the browser-side wizard (web/app_template.html and its JS) is mostly AI-generated and has had far less real-world exercise than the core library and CLI. Treat it as more experimental.

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.

The DEGIRO importer is a community effort: contributed by @manuelgr0, with multilingual support by @dalpozz and improved French support plus test data by @VincentBlondeau.

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

Stars

372 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages