Depending on canton and taxable income, marginal tax rates can be up to 42%, if I remember correctly. You’d have to check for your canton/municipality and taxable income to estimate this.
As I understand it, you’d be considered self-employed, which means you’d also have to pay social security on your net profits (about 10%, at least that would be tax-deductible as well).
To me it would be surprising if you’re considered self-employed without being required to contribute to pillar 1. A few sources that point to self-employment and/or AHV contributions:
Kreisschreiben Nr. 36:
Dieses Kreisschreiben dient als Hilfsmittel zur Abgrenzung einer selbständigen Erwerbs-
tätigkeit (Quasi-Wertschriftenhandel) von der privaten Vermögensverwaltung.
Gemäss DBG Art. 16 Abs. 3 und StG § 23 Buchstabe b sind Kapitalgewinne auf Privatvermögen steuerfrei. Steuerbar werden die Kapitalgewinne aber, wenn sie im Rahmen einer selbständigen Erwerbstätigkeit erzielt werden. Dabei spielt es keine Rolle, ob die Tätigkeit im Haupt- oder Nebenberuf, regelmässig, wiederkehrend oder nur einmal ausgeübt wurde. Kapitalgewinne unterliegen dann der direkten Bundessteuer, den kantonalen Steuern und auch der AHV-Beitragspflicht.
Die Kapitalgewinne sind beim Bund, Kanton sowie bei der AHV steuer- und abgabepflichtig.
I stumbled on this thread since I wanted to develop a tool to create such barcodes. The effort to program this is probably quite high, but if other people could profit, that would be nice.
I never had to upload any broker statements (even for withholding taxes) - this might depend on the canton though. The use of a custom would probably not be a problem since the person filling out the form is still fully responsible. And a signature doesn’t seem to be required by the standard, so this shouldn’t be required either.
They recommend the use of a Java library, and also provide more precise information on how to use said library.
Easiest would probably be to create a tool for XML → eCH-0196 PDF to allow some flexibility in the input.
If someone would be up to create such a tool, let me know
I’m pretty sure the problem is that even if you produce correct reports, you will not be able to get an approved key to sign the tax statement and therefore the reports will not be accepted/imported into the tax statements.
I know about it. The problem is that you don’t know what you have to put into the XML and how it’s split up and signing and whatever. Maybe I’m wrong, but that’s what I remember.
Signing the XML contained in the barcodes does not seem to be required, this is only the case for an attached XML (see specification).
The high complexity lies in the barcode creation, not in the XML-creation. This is why the simplest solution for personal projects would be the use of Selenium for example (as mentioned above). But this would only work per-canton and not for all cantons as a barcode would / should.
@j_from_b Wow, this sounds awesome. I have not tested it so far, but I really like the idea. No privacy concerns, fully open source. I would suggest that we extract this into an own thread for your solution. It also sounds pretty extendable for any other broker / bank.
What is the status of IBKR? Can you probably share a report based on dummy data?
No certificate seems be required. In fact I cannot see any signatures in any of the payloads for statements I have from other banks.
I tried reaching out to the listed email adres for new implementers and got no response
There has been one real world use case and ZH Private Tax accepted it.
The fornat assumes yiu are a bank in some places so some fakery is required. For instance the 1D barcode on each page that is used by the document scanner if you use paper requires a Bankleitzahl.
It has been accepted at least once by ZH private tac
iBKR and Schwab work for me with fairly run of the mill ETGss & security lending
All formats ate under documented. For instance I don’t how IBKR represents stock splits and the last rights issue was also too long ago do me.
Using investments not on the kurskiste does bot work (skeketon is there) but i general outsourcing the actual tac decisions to IC Tax seems the bettter strategy
It is nissing day level authoritative exchange rate data. The tax iffice can correct on import (IC Yax publishes only monthly)
If somebody has paper trading on IBKR that they xan donate for test data that would be great
This is for tinkerers. datalevel.ch is the option if you want polish & matury
OK. Great! After some tinkering, I managed to generate a PDF.
I need to double check to see how accurate it is.
I also added functionality for it to check for missing ISINs:
Updated data/security_identifiers.csv
Total entries: 178 securities
With ISINs: 169 (95%)
Without ISINs: 9 (e.g. futures/options that typically don't have ISINs)
The 9 securities without ISINs (all futures/options):
[list of securities]
This finding is pretty useful: while searching for this taxstatement-api file, I have found this page, which even mentions your post here. This goes pretty much into details, because they found a security issue in the library. They pretty much explain how to retrieve the file from public sources.
Based on this, I went down the rabbit hole, and looked into the .jar file using IntelliJ decompiler. In the end, I was able to generate a PDF (and even an official validation report) for the sample XML created by @j_from_b . There is way more config params available for styling and configuration the PDF, but for now I had to stop. The funny thing is, that the jar official jar file even contains some official logos and other content from banks - looks like they are also using this tool.
Let’s hope this helps @j_from_b a bit. I really like the idea of creating an open source generator for this, which also works for banks and brokers who do not offer digital CH tax statements. Also the validation tool seems to be quite helpful - it already reports some issues for the sample XML file.
I had to attach the script as text because I cannot upload text files here. Feel free to edit my post.
#!/bin/sh
# script to download official taxstatement.jar from public sources.
# the jar is mentioned in the official technical documentation:
# https://www.ech.ch/sites/default/files/dosvers/beilagen/BEIL2_d_DEF_2022-06-07_eCH-0196_V2.0.0_Barcode%20Generierung%20-%20Technische%20Wegleitung.pdf
# it also fetches a sample XML file from https://github.com/vroonhof/opensteuerauszug and creates a PDF and validation report
mkdir taxstatement
cd taxstatement
wget https://efisc.kttg.ch/update/eFisc/2025/efisc2025_1.0.2-70_amd64.deb
ar x efisc2025_1.0.2-70_amd64.deb data.tar.zst
tar --use-compress-program=zstd -xf data.tar.zst --transform 's,.*/,,g' ./usr/share/efisc2025/taxstatement-2.2.4.1.jar
rm data.tar.zst
# libs for creating PDF
wget https://repo1.maven.org/maven2/uk/org/okapibarcode/okapibarcode/0.5.2/okapibarcode-0.5.2.jar
wget https://repo1.maven.org/maven2/org/apache/pdfbox/fontbox/2.0.35/fontbox-2.0.35.jar
wget https://repo1.maven.org/maven2/org/apache/pdfbox/pdfbox/2.0.35/pdfbox-2.0.35.jar
wget https://repo1.maven.org/maven2/commons-logging/commons-logging/1.3.5/commons-logging-1.3.5.jar
# additional libs for validation report
wget https://repo1.maven.org/maven2/org/apache/poi/poi/5.5.1/poi-5.5.1.jar
wget https://repo1.maven.org/maven2/org/apache/poi/poi-ooxml/5.5.1/poi-ooxml-5.5.1.jar
wget https://repo1.maven.org/maven2/org/apache/poi/poi-ooxml-lite/5.5.1/poi-ooxml-lite-5.5.1.jar
wget https://repo1.maven.org/maven2/commons-io/commons-io/2.21.0/commons-io-2.21.0.jar
wget https://repo1.maven.org/maven2/org/apache/xmlbeans/xmlbeans/5.3.0/xmlbeans-5.3.0.jar
wget https://repo1.maven.org/maven2/org/apache/commons/commons-collections4/4.5.0/commons-collections4-4.5.0.jar
wget https://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.28.0/commons-compress-1.28.0.jar
wget https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api/2.25.3/log4j-api-2.25.3.jar
wget https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.25.3/log4j-core-2.25.3.jar
# additional libs for PDF to XML extraction
wget https://repo1.maven.org/maven2/com/google/zxing/core/3.5.4/core-3.5.4.jar
wget https://repo1.maven.org/maven2/com/google/zxing/javase/3.5.4/javase-3.5.4.jar
# the following is only needed for demonstration purposes
wget https://raw.githubusercontent.com/vroonhof/opensteuerauszug/refs/heads/main/tests/samples/fake_statement.xml
# creates PDF
# force needed for fake_statement.xml because it seems to miss some needed declarations: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ech.ch/xmlns/eCH-0196/2.2/eCH-0196-2-2.xsd http://www.ech.ch/xmlns/eCH-0097/4/eCH-0097-4-0.xsd"
java -Dforce=true -Dssk=false -Dpdf=true -cp "./*" ch.ewv.taxstatement.examples.TaxStatementMain fake_statement.xml
# creates validation report
java -Dxlsx=true -cp "./*" ch.ewv.taxstatement.examples.TaxStatementMain fake_statement.xml
# extracts XML from a PDF
java -cp "./*" ch.ewv.taxstatement.examples.TaxStatementPDFToXML fake_statement.pdf extracted.xml
By reading and partipating to this forum, you confirm you have read and agree with the disclaimer presented on http://www.mustachianpost.com/
En lisant et participant à ce forum, tu confirmes avoir lu et être d'accord avec l'avis de dégagement de responsabilité présenté sur http://www.mustachianpost.com/fr/
Durch das Lesen und die Teilnahme an diesem Forum bestätigst du, dass du den auf http://www.mustachianpost.com/de/ dargestellten Haftungsausschluss gelesen hast und damit einverstanden bist.