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 ./reports --year 2024
The tool automatically:
- Reads one XLSX report or a directory with multiple annual reports
- 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.11 or later is required.
Using pip (from PyPi)
-
Install via
pip:pip install pit8c
-
Now you can use the
pit8ccommand:pit8c --help
Using uv (only for developers)
-
Clone this repository:
git clone https://github.com/iyazerski/pit8c.git cd pit8c
-
Install dependencies via uv:
uv sync -
To run the CLI:
uv run pit8c --help
Usage
Processing an Annual Report
To calculate PIT-8C for a given tax year, pass either:
- a single annual report
.xlsx, or - a directory containing multiple annual reports
.xlsx(recommended, so FIFO can match prior-year buys).
pit8c <broker> <reports_path> --year <tax_year>
- broker: the broker’s name (lowercase).
- reports_path: path to a single XLSX report or a directory with multiple reports.
- tax_year: the year for which PIT-8C should be calculated (only positions with sell date in that year are included).
The tool will:
- Read one or more broker XLSX files.
- Convert all trades (buy and sell) into an internal unified structure based on ISIN and currency.
- Apply FIFO matching across all provided years to determine partial closures.
- Select only positions closed (sold) in the requested tax year.
- Compute income and costs for selected positions.
- Generate PIT-8C PDF report and save it near the input path.
- Print D section of PIT-8C report to console.
- Write the closed positions near the input file (for audit).
Example:
pit8c freedom24 ./reports --year 2025
Testing
We use pytest for testing. Critical logic parts are covered (e.g. FIFO algorithm, trades parsing).
To run the tests:
uv 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.5.tar.gz.
File metadata
- Download URL: pit8c-0.0.5.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a2ce52d9562498c5f57c93db331b7fede11c80f6d65c56953c706310406af20
|
|
| MD5 |
734bb389229270363ca6a0d66df7eb97
|
|
| BLAKE2b-256 |
1162421083f19ce3f8e394a3fc0d3e84fa9bb2754aab331d217ea2efeabd4180
|
Provenance
The following attestation bundles were made for pit8c-0.0.5.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.5.tar.gz -
Subject digest:
1a2ce52d9562498c5f57c93db331b7fede11c80f6d65c56953c706310406af20 - Sigstore transparency entry: 813329128
- Sigstore integration time:
-
Permalink:
iyazerski/pit8c@31baee20e028383d8b9af666b044def1d6f7c44b -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/iyazerski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@31baee20e028383d8b9af666b044def1d6f7c44b -
Trigger Event:
push
-
Statement type:
File details
Details for the file pit8c-0.0.5-py3-none-any.whl.
File metadata
- Download URL: pit8c-0.0.5-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28ec62d01775382ea14be4dc3a9610b9d8ebb529f7eda605f641bfed117afdca
|
|
| MD5 |
aad0d848ae5c82a762ce4fc49c279afd
|
|
| BLAKE2b-256 |
8d266719e15837564ebaa1b5474abb6447e276597f5346e9b8e0c7c429fc3efe
|
Provenance
The following attestation bundles were made for pit8c-0.0.5-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.5-py3-none-any.whl -
Subject digest:
28ec62d01775382ea14be4dc3a9610b9d8ebb529f7eda605f641bfed117afdca - Sigstore transparency entry: 813329129
- Sigstore integration time:
-
Permalink:
iyazerski/pit8c@31baee20e028383d8b9af666b044def1d6f7c44b -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/iyazerski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@31baee20e028383d8b9af666b044def1d6f7c44b -
Trigger Event:
push
-
Statement type: