GitHub Gems

Open-Source n8n Bot Calculates Czech Tax on Broker Investments

A GitHub project by VChegil uses a self-hosted n8n workflow and a Telegram bot to estimate Czech personal income tax on Trading 212 and Interactive Brokers investments.

Illustration of a smartphone chat with a Telegram bot showing an estimated Czech tax figure beside a stock chart
Photo: GitHub

A self-hosted automation workflow published on GitHub on 14 October 2026 promises to estimate Czech personal income tax on investments held at Trading 212 and Interactive Brokers. The project, found in the n8n-ai-automation repository under the account VChegil, runs on n8n, a workflow automation platform that users can host on their own machines or servers. Investors interact with it through a Telegram bot: they send the broker’s CSV statement to the bot, which stores their purchase records and answers questions such as how much tax they would owe if they sold a position that day.

How the bot works

According to the project’s README, the workflow needs no access to bank or broker accounts. Users export their own statements and upload them, and all data remains inside their personal n8n instance. That design answers a common concern among people who track investments across platforms: the tool asks for files, not logins.

The README describes a long list of features. The workflow skips files that have already been imported and rejects statements whose date range overlaps one already on record. It reads Trading 212 exports and Interactive Brokers Activity Statements, including foreign exchange fees, stock splits that are missing from the Trading 212 export, and daily cash interest, which it totals per month.

Matching sales to purchases

The core of the calculation is matching each sale to earlier purchases. The project uses first-in, first-out (FIFO) accounting, so each sale is assigned to the oldest purchase lots still held. Buys made on the same day for the same instrument are merged into a single lot. Trading 212 positions are identified by ISIN, while Interactive Brokers positions are identified by ticker symbol.

Every amount is converted at the daily exchange rate published by the Czech National Bank (ČNB) for the date of that specific transaction. The README says the rates are fetched once and then cached, which reduces repeated requests during a calculation.

The Czech rules behind the numbers

The tool applies several rules that Czech investors typically need to understand when preparing a tax return. The README lists the following:

  • Three-year test: a lot held for at least three years is exempt from tax on its gain. The project calls this the časový test.
  • Yearly sales limit: if total sales proceeds in a calendar year are 100,000 CZK or less, all gains for that year are exempt. If proceeds exceed that amount, every gain not covered by the three-year test is taxable.
  • Losses: losses offset gains only within the same year.
  • Dividends: booked gross at the 15 percent Czech rate, with foreign withholding tax credited up to 15 percent per country. The country is determined from the ISIN.
  • Interest: taxed at 15 percent, with nothing withheld.

Each event is assigned to the tax year in which it occurred. The README notes one exception: Interactive Brokers withholding corrections that relate to the previous year are booked to that previous year.

Why the calculation is sensitive to dates

Because purchase and sale dates determine both the exchange rate and the holding period, small errors in an import can change the result. This is why the README asks users to send statements in chronological order and to wait for the bot’s reply after each file. FIFO cannot work correctly if a sale is processed before the purchase it depends on.

Setup and known limits

The project requires a self-hosted n8n installation recent enough to support Data Tables. Setup involves storing a Telegram bot token as an environment variable, creating six Data Tables with exactly matching column names, importing the workflow file, connecting Telegram and Data Table nodes, and entering the user’s numeric Telegram ID so the bot ignores other senders. The bot can reply in English, Czech or Ukrainian, controlled by a single setting.

The README is clear about what the tool does not cover. It handles stocks and ETFs only, not options, futures or bonds. Corporate actions other than stock splits, such as spin-offs and mergers, must be handled by hand, as must transfers between brokers. Splits that are absent from the Trading 212 export have to be added to a list in the Parse Import node. The author cites a 10-for-1 NVIDIA split from 2024 as an entry already included. Currency support is limited to euros, US dollars and pounds sterling, with more currencies added in the Parse CNB response node.

The import process also has a safeguard. The workflow writes results only at the end of a run, so a failed run stores nothing and the same file can be sent again without creating duplicates.

What it means for investors

For Czech residents who trade through Trading 212 or Interactive Brokers, the project offers a way to test tax scenarios before placing a sale. It also shows how much manual bookkeeping can be automated when broker exports are consistent. Users who prefer not to host their own infrastructure would need another approach, because the workflow depends on a self-hosted n8n instance.

The author states plainly that the tool is a personal project and not tax advice. The figures are estimates, and the README directs users to compare each result with the official instructions for the relevant year, the Pokyny k vyplnění, or to consult a licensed tax adviser, known in Czech as a daňový poradce, before filing. Readers should treat the project as a calculator to check against official guidance, not as a replacement for it.

Source: GitHub

Comments (0)