Skip to main content

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:

  1. Match each sale to its original purchase (including partial closures)
  2. Convert all foreign amounts to PLN using NBP rates from transaction dates
  3. Calculate total income/costs for tax declaration
  4. 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.11 or later is required.

Using pip (from PyPi)

  1. Install via pip:

    pip install pit8c
    
  2. Now you can use the pit8c command:

    pit8c --help
    

Using uv (only for developers)

  1. Clone this repository:

    git clone https://github.com/iyazerski/pit8c.git
    cd pit8c
    
  2. Install dependencies via uv:

    uv sync
    
  3. To run the CLI:

    uv run 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:

  1. Read the broker’s XLSX file.
  2. Convert all trades (buy and sell) into an internal unified structure based on ISIN and currency.
  3. Apply FIFO matching to determine partial closures.
  4. Compute income and costs for each matched position.
  5. Generate PIT-8C PDF report and save it near the input file.
  6. Print D section of PIT-8C report to console.
  7. 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:

uv run pytest

Contributing

Contributions are welcome! Please open an issue or create a pull request:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Open a pull request towards the main branch.

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

pit8c-0.0.4.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pit8c-0.0.4-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file pit8c-0.0.4.tar.gz.

File metadata

  • Download URL: pit8c-0.0.4.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pit8c-0.0.4.tar.gz
Algorithm Hash digest
SHA256 06a8df993cca636a7497f83285694d51eec078e147aa3329ac8cfa37c15ecc5d
MD5 8d68f6b1be89ee3d32b6f6867529d071
BLAKE2b-256 a8cfb5b6834f97994ee5d9eaf8dbc19ae2277f144189ae5fe533b3a2d24100b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pit8c-0.0.4.tar.gz:

Publisher: release.yml on iyazerski/pit8c

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pit8c-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pit8c-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pit8c-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5ee85462b200fff9111a4f663552b9c45e51cc5ab627190fc024f9b4c807aaaf
MD5 1096cbf5bf9e80f28bee1f550b851155
BLAKE2b-256 2e8921ad8ca2ec10251ceeb746d90d51785eb8212c7ece26e8160b3872eefac7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pit8c-0.0.4-py3-none-any.whl:

Publisher: release.yml on iyazerski/pit8c

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page