tobcalc-demo.mp4
tobcalc is a project that calculates the Belgian transaction tax on securities for various brokers and fills in the PDF form associated with these taxes.
The core library used by tobcalc is in a separate repository: tobcalc-lib
- Why does this project exist?
- Which brokers are currently supported?
- How does it work?
- Is it secure?
- To-do list
Belgian brokers pay the transaction tax, also known as the TOB, automatically for you. However, if you use a foreign broker, such as Interactive Brokers or Trading212, you will have to calculate, pay and file this tax manually for every transaction you made in the period of 2 months. This process can be time-consuming and frustrating, which is why many Belgian investors decide not to use foreign brokers despite them possibly fitting their needs better than domestic brokers.
The goal of this project is to simplify the process of calculating and filing the TOB. By doing so, the threshold is lowered for Belgian investors that would like to invest using their broker of choice.
Currently, the following brokers are supported:
- Interactive Brokers (last checked: 28 March 2022) (guide)
- Trading212 (last checked: 29 March 2022) (no guide yet)
- DEGIRO (last checked: 2 April 2023) (guide)
- Boursorama (last checked: 3 April 2023) (guide)
Nearly all brokers allow you to export your transactions as a CSV or Excel file. That file will then be read by tobcalc and converted into a simplified format which only includes the data needed to calculate the tax on the transactions. If necessary, the data relating to a transaction's security will be fetched from an investing site so the parameters needed to accurately calculate the tax rate can be determined. If the transaction was made in a foreign currency, the exchange rate for that day will be fetched from the European Central Bank.
Once the data is complete with the parameters needed to calculate the tax rates and has been converted into the right format, the actual taxes will be calculated and the PDF form will be filled in.
The transactions file gets processed locally. For transactions in a foreign currency, the exchange rate on the date of the transaction will be fetched from the European Central Bank. This means that the date of the transaction and the currency will be sent to their server. To determine the type of security in a transaction, the security's ISIN is sent to Yahoo Finance. If the security is an ETF, the ISIN will also be sent to JustETF to determine whether the fund is accumulating or distributing.
Read more details on tobcalc's security details and design here.
- Issue #11: the calculated tax rates can go above the ceilings set by the Belgian government. The ceiling was never implemented in tobcalc as at the start of the project, it was clear that it wouldn't be reached by most users. However, to ensure correctness, this should be implemented.
- Issue #11: on Interactive Brokers, trades that are filled in partial fills are considered separate trades. It should be possible to merge these trades into one to not only ensure the correct quantity is used for the tax calculation, but it also has an effect on the ceiling of the tax rate.
- It should be possible to merge trades into one. This could be implemented in a similar way to how the filter broker transactions or failed security fetches prompts work.
- A clean-up of the codebase is needed. Some of the code, especially regarding the way prompts work and how default values are handled, is a bit hacky. I would like to find a more robust way to handle this. Some of the proxies are also unused and can be removed.