A CLI tool that assists in preparing the PIT-8C declaration based on the annual tax reports from your broker
Project description
PIT-8C
pit8c is a command-line tool that assists you in preparing the Polish PIT-8C
declaration for investment income. It transforms raw broker reports into tax-ready documents by handling
complex calculations, currency conversions, and FIFO trade matching - all while adhering to Polish tax regulations.
Table of Contents
Example Use Case
Marta, a Polish investor, made 200+ stock trades in 2024 through Freedom24, including US and EU stocks. Since Freedom24 is based in Cyprus, it doesn't generate a PIT-8C declaration. So Marta needs to:
- Match each sale to its original purchase (including partial closures)
- Convert all foreign amounts to PLN using NBP rates from transaction dates
- Calculate total income/costs for tax declaration
- Manually fill the PIT-8C declaration
With pit8c, she simply runs:
pit8c freedom24 annual_report_2024.xlsx
The tool automatically:
- Processes all trades from the XLSX report
- Matches sales with purchases using FIFO
- Applies correct NBP exchange rates (even for weekend trades)
- Generates ready-to-submit PIT-8C (.pdf file)
- Creates audit-ready XLSX with all calculations
No more spreadsheet errors or manual rate lookups. 🚀
Installation
- Python 3.10 or later is required.
Using pip (from PyPi)
-
Install via
pip:pip install pit8c
-
Now you can use the
pit8ccommand:pit8c --help
Using Poetry (only for developers)
-
Clone this repository:
git clone https://github.com/iyazerski/pit8c.git cd pit8c
-
Install dependencies via Poetry:
poetry install -
To run the CLI:
pit8c --help
Usage
Processing an Annual Report
To process your annual tax report (.xlsx file with all the trades made during the year), use:
pit8c <broker> <tax_report_file>
- broker: the broker’s name (lowercase).
- tax_report_file: the XLSX file with all your trades downloaded from the supported broker.
The tool will:
- Read the broker’s XLSX file.
- Convert all trades (buy and sell) into an internal unified structure based on ISIN and currency.
- Apply FIFO matching to determine partial closures.
- Compute income and costs for each matched position.
- Generate PIT-8C PDF report and save it near the input file.
- Print D section of PIT-8C report to console.
- Write the closed positions near the input file (for audit).
Example:
pit8c freedom24 annual_report_2024.xlsx
Testing
We use pytest for testing. Critical logic parts are covered (e.g. FIFO algorithm, trades parsing).
To run the tests:
poetry run pytest
Contributing
Contributions are welcome! Please open an issue or create a pull request:
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a pull request towards the
mainbranch.
Be sure to include tests to cover new functionality or bug fixes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Disclaimer: This tool is provided as-is. The authors and contributors are not responsible for any inaccuracies or omissions in the tax calculations. Always consult a certified tax adviser or official resources to verify the correctness of your tax returns.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pit8c-0.0.3.tar.gz.
File metadata
- Download URL: pit8c-0.0.3.tar.gz
- Upload date:
- Size: 158.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab0ffba1c291fbe8f47e96bb3dc8eb7c1b33bb027912fee0417de9ccf15f4f9b
|
|
| MD5 |
5b4c52cfb070e7ffc2e83b05d5062cf5
|
|
| BLAKE2b-256 |
79d7f03c601f5563b1cdbbeae3f72034863e2b798953871f9ab6d5ce52267aff
|
Provenance
The following attestation bundles were made for pit8c-0.0.3.tar.gz:
Publisher:
release.yml on iyazerski/pit8c
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pit8c-0.0.3.tar.gz -
Subject digest:
ab0ffba1c291fbe8f47e96bb3dc8eb7c1b33bb027912fee0417de9ccf15f4f9b - Sigstore transparency entry: 165981088
- Sigstore integration time:
-
Permalink:
iyazerski/pit8c@7eef52fde61535ade88778d4d5a648382933942f -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/iyazerski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7eef52fde61535ade88778d4d5a648382933942f -
Trigger Event:
push
-
Statement type:
File details
Details for the file pit8c-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pit8c-0.0.3-py3-none-any.whl
- Upload date:
- Size: 160.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8970fe642a5ecb339dc6ce3ad6de914c789a21767400796b428fb9712cfdb949
|
|
| MD5 |
8c645264e81b9c3d9ea049e58a992ef1
|
|
| BLAKE2b-256 |
b0aee2792042be478014c892c259202d403530eae89877438a4af62e451574e6
|
Provenance
The following attestation bundles were made for pit8c-0.0.3-py3-none-any.whl:
Publisher:
release.yml on iyazerski/pit8c
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pit8c-0.0.3-py3-none-any.whl -
Subject digest:
8970fe642a5ecb339dc6ce3ad6de914c789a21767400796b428fb9712cfdb949 - Sigstore transparency entry: 165981090
- Sigstore integration time:
-
Permalink:
iyazerski/pit8c@7eef52fde61535ade88778d4d5a648382933942f -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/iyazerski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7eef52fde61535ade88778d4d5a648382933942f -
Trigger Event:
push
-
Statement type: