{"id":24736212,"url":"https://github.com/iyazerski/pit8c","last_synced_at":"2025-03-22T17:16:17.914Z","repository":{"id":273071205,"uuid":"918619086","full_name":"iyazerski/pit8c","owner":"iyazerski","description":"A CLI tool that assists in preparing the PIT-8C declaration based on the annual tax reports from your broker","archived":false,"fork":false,"pushed_at":"2025-01-27T20:49:59.000Z","size":551,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T01:49:54.947Z","etag":null,"topics":["fifo","pit8c","poland","python","typer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iyazerski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-18T12:15:51.000Z","updated_at":"2025-03-16T21:14:31.000Z","dependencies_parsed_at":"2025-01-25T20:19:51.000Z","dependency_job_id":null,"html_url":"https://github.com/iyazerski/pit8c","commit_stats":null,"previous_names":["iyazerski/pit38","iyazerski/pit8c"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyazerski%2Fpit8c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyazerski%2Fpit8c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyazerski%2Fpit8c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyazerski%2Fpit8c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iyazerski","download_url":"https://codeload.github.com/iyazerski/pit8c/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244991177,"owners_count":20543627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fifo","pit8c","poland","python","typer"],"created_at":"2025-01-27T21:18:12.471Z","updated_at":"2025-03-22T17:16:17.731Z","avatar_url":"https://github.com/iyazerski.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PIT-8C\n\n`pit8c` is a command-line tool that assists you in preparing the Polish [PIT-8C](https://www.pit.pl/pit-8c/)\ndeclaration for investment income. It transforms raw broker reports into tax-ready documents by handling\ncomplex calculations, currency conversions, and FIFO trade matching - all while adhering to Polish tax regulations.\n\n---\n\n## Table of Contents\n\n- [Example Use Case](#example-use-case)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Testing](#testing)\n- [Contributing](#contributing)\n- [License](#license)\n\n---\n\n## Example Use Case\n*Marta, a Polish investor, made 200+ stock trades in 2024 through Freedom24, including US and EU stocks.\nSince Freedom24 is based in Cyprus, it doesn't generate a PIT-8C declaration. So Marta needs to:*\n1. Match each sale to its original purchase (including partial closures)\n2. Convert all foreign amounts to PLN using NBP rates from transaction dates\n3. Calculate total income/costs for tax declaration\n4. Manually fill the PIT-8C declaration\n\n*With pit8c, she simply runs:*\n```bash\npit8c freedom24 annual_report_2024.xlsx\n```\n\nThe tool automatically:\n- Processes all trades from the XLSX report\n- Matches sales with purchases using FIFO\n- Applies correct NBP exchange rates (even for weekend trades)\n- Generates ready-to-submit [PIT-8C](https://www.pit.pl/pit-8c/) (.pdf file)\n- Creates audit-ready XLSX with all calculations\n\nNo more spreadsheet errors or manual rate lookups. 🚀\n\n---\n\n## Installation\n\n- **Python 3.10 or later** is required.\n\n### Using `pip` (from `PyPi`)\n\n1. Install via `pip`:\n\n   ```bash\n   pip install pit8c\n   ```\n\n2. Now you can use the `pit8c` command:\n\n   ```bash\n   pit8c --help\n   ```\n\n### Using Poetry (only for developers)\n\n1. Clone this repository:\n\n   ```bash\n   git clone https://github.com/iyazerski/pit8c.git\n   cd pit8c\n   ```\n\n2. Install dependencies via [Poetry](https://python-poetry.org/):\n\n   ```bash\n   poetry install\n   ```\n\n3. To run the CLI:\n\n   ```bash\n   pit8c --help\n   ```\n\n---\n\n## Usage\n\n### Processing an Annual Report\n\nTo process your annual tax report (.xlsx file with all the trades made during the year), use:\n\n```bash\npit8c \u003cbroker\u003e \u003ctax_report_file\u003e\n```\n\n- **broker**: the broker’s name (lowercase).\n- **tax_report_file**: the XLSX file with all your trades downloaded from the supported broker.\n\nThe tool will:\n\n1. Read the broker’s XLSX file.\n2. Convert all trades (buy and sell) into an internal unified structure based on ISIN and currency.\n3. Apply FIFO matching to determine partial closures.\n4. Compute income and costs for each matched position.\n5. Generate PIT-8C PDF report and save it near the input file.\n6. Print D section of PIT-8C report to console.\n7. Write the closed positions near the input file (for audit).\n\n**Example**:\n\n```bash\npit8c freedom24 annual_report_2024.xlsx\n```\n\n---\n\n## Testing\n\nWe use [pytest](https://docs.pytest.org/) for testing. Critical logic parts are covered (e.g. FIFO algorithm, trades parsing).\n\nTo run the tests:\n\n```bash\npoetry run pytest\n```\n\n---\n\n## Contributing\n\nContributions are welcome! Please open an [issue](https://github.com/iyazerski/pit8c/issues) or create a pull request:\n\n1. **Fork** the repository\n2. **Create a feature branch**\n3. **Commit** your changes\n4. **Open a pull request** towards the `main` branch.\n\nBe sure to include tests to cover new functionality or bug fixes.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n\n**Disclaimer**:\nThis 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiyazerski%2Fpit8c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiyazerski%2Fpit8c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiyazerski%2Fpit8c/lists"}