{"id":13522640,"url":"https://github.com/siddhantgoel/beancount-dkb","last_synced_at":"2025-04-10T13:30:52.128Z","repository":{"id":31405421,"uuid":"127779406","full_name":"siddhantgoel/beancount-dkb","owner":"siddhantgoel","description":"Beancount Importers for DKB (Deutsche Kredit Bank) CSV Exports","archived":false,"fork":false,"pushed_at":"2024-04-29T17:12:52.000Z","size":693,"stargazers_count":31,"open_issues_count":3,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-02T02:15:28.867Z","etag":null,"topics":["accounting","banking","beancount","dkb","finance","germany","personal-finance","plaintext-accounting","python","python3"],"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/siddhantgoel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"siddhantgoel"}},"created_at":"2018-04-02T16:04:22.000Z","updated_at":"2024-05-12T17:37:59.737Z","dependencies_parsed_at":"2023-02-10T05:46:03.229Z","dependency_job_id":"b997ce3a-ff8f-4510-846c-293484bc089e","html_url":"https://github.com/siddhantgoel/beancount-dkb","commit_stats":{"total_commits":377,"total_committers":11,"mean_commits":34.27272727272727,"dds":0.7161803713527852,"last_synced_commit":"7fbbb897fd0e53d3116dc5c38cce448db04a6d60"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhantgoel%2Fbeancount-dkb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhantgoel%2Fbeancount-dkb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhantgoel%2Fbeancount-dkb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhantgoel%2Fbeancount-dkb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siddhantgoel","download_url":"https://codeload.github.com/siddhantgoel/beancount-dkb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248225707,"owners_count":21068078,"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":["accounting","banking","beancount","dkb","finance","germany","personal-finance","plaintext-accounting","python","python3"],"created_at":"2024-08-01T06:00:50.434Z","updated_at":"2025-04-10T13:30:52.096Z","avatar_url":"https://github.com/siddhantgoel.png","language":"Python","funding_links":["https://github.com/sponsors/siddhantgoel"],"categories":["Importers","Python"],"sub_categories":["Germany"],"readme":"# Beancount DKB Importer\n\n[![image](https://img.shields.io/pypi/v/beancount-dkb.svg)](https://pypi.python.org/pypi/beancount-dkb)\n[![image](https://img.shields.io/pypi/pyversions/beancount-dkb.svg)](https://pypi.python.org/pypi/beancount-dkb)\n[![Downloads](https://static.pepy.tech/badge/beancount-dkb)](https://pepy.tech/project/beancount-dkb)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n`beancount-dkb` provides importers for converting CSV exports of [DKB] (Deutsche\nKreditbank) account summaries to the [Beancount] format.\n\n## Installation\n\n```sh\n$ pip install beancount-dkb\n```\n\nIn case you prefer installing from the Github repository, please note that `main` is the\ndevelopment branch so `stable` is what you should be installing from.\n\n## Usage\n\nIf you're not familiar with how to import external data into Beancount, please read\n[this guide] first.\n\n### Beancount 3.x\n\nBeancount 3.x has replaced the `config.py` file based workflow in favor of having a\nscript based workflow, as per the [changes documented here]. The `beangulp` examples\nsuggest using a Python script based on `beangulp.Ingest`. Here's an example of how that\nmight work:\n\nAdd an `import.py` script in your project root with the following contents:\n\n```python\nfrom beancount_dkb import ECImporter, CreditImporter\nfrom beangulp import Ingest\n\nimporters = (\n    ECImporter(\n        \"DE99 9999 9999 9999 9999 99\",\n        'Assets:DKB:EC',\n        currency='EUR',\n    ),\n\n    CreditImporter(\n        \"9999 9999 9999 9999\",\n        'Assets:DKB:Credit',\n        currency='EUR',\n    )\n)\n\nif __name__ == \"__main__\":\n    ingest = Ingest(importer)\n    ingest()\n```\n\n... and run it directly using `python import.py extract`.\n\n### Beancount 2.x\n\nAdjust your [config file] to include `ECImporter` and `CreditImporter`\n(depending on what account you're trying to import).\n\nAdd the following to your `config.py`.\n\n```python\nfrom beancount_dkb import ECImporter, CreditImporter\n\nCONFIG = [\n    ECImporter(\n        \"DE99 9999 9999 9999 9999 99\",\n        \"Assets:DKB:EC\",\n        currency='EUR',\n    ),\n\n    CreditImporter(\n        \"9999 9999 9999 9999\",\n        \"Assets:DKB:Credit\",\n        currency='EUR',\n    )\n]\n```\n\nOnce this is in place, you should be able to run `bean-extract` on the command\nline to extract the transactions and pipe all of them into your Beancount file.\n\n```sh\n$ bean-extract /path/to/config.py transaction.csv \u003e\u003e you.beancount\n```\n\n### Transaction Codes as Meta Tags\n\nBy default, the ECImporter prepends the transaction code (\"Buchungstext\") to the\ntransaction description. To achieve shorter descriptions and use meta tags to query for\ncertain transaction codes, the importer may be configured to store the transaction code\nin a user provided meta tag.\n\nAdd the `meta_code` parameter when instantiating an `ECImporter`.\n\n#### Beancount 3.x\n\n```python\nfrom beancount_dkb import ECImporter\nfrom beangulp import Ingest\n\nimporters = (\n    ECImporter(\n        \"DE99 9999 9999 9999 9999 99\",\n        \"Assets:DKB:EC\",\n        meta_code=\"code',\n    ),\n)\n\nif __name__ == \"__main__\":\n    ingest = Ingest(importer)\n    ingest()\n```\n\n#### Beancount 2.x\n\n```python\n...\nCONFIG = [\n    ECImporter(\n        IBAN_NUMBER,\n        'Assets:DKB:EC',\n        currency='EUR',\n        meta_code='code',\n    ),\n...\n```\n\nThis is how an example transaction looks without the option:\n\n```beancount\n2021-03-01 * \"Kartenzahlung\" \"XY Supermarket\"\n    Assets:DKB:EC                        -133.72 EUR\n```\n\nAnd this is the resulting transaction using `meta_code='code'`\n\n```beancount\n2021-03-01 * \"XY Supermarket\"\n    code: Kartenzahlung\n    Assets:DKB:EC                        -133.72 EUR\n```\n\n### Pattern-matching Transactions\n\nIt's possible to give the importer classes hints if you'd like them to include a\nsecond posting based on specific characteristics of the original transaction.\n\nFor instance, if the payee or the description in a transaction always matches a\ncertain value, it's possible to tell the `ECImporter` or `CreditImporter` to\nautomatically place a second posting in the returned lits of transactions.\n\n#### `ECImporter`\n\n`ECImporter` accepts `payee_patterns` and `description_patterns` arguments, which should\nbe a list of `(pattern, account)` tuples.\n\n##### Beancount 3.x\n\n```python\nfrom beancount_dkb import ECImporter\nfrom beangulp import Ingest\n\nimporters = (\n    ECImporter(\n        \"DE99 9999 9999 9999 9999 99\",\n        \"Assets:DKB:EC\",\n        payee_patterns=[\n            (\"REWE\", \"Expenses:Supermarket:REWE\"),\n            (\"NETFLIX\", \"Expenses:Online:Netflix\"),\n        ],\n    ),\n)\n\nif __name__ == \"__main__\":\n    ingest = Ingest(importer)\n    ingest()\n```\n\n##### Beancount 2.x\n\n```python\nCONFIG = [\n    ECImporter(\n        IBAN_NUMBER,\n        \"Assets:DKB:EC\",\n        currency='EUR',\n        payee_patterns=[\n            (\"REWE\", \"Expenses:Supermarket:REWE\"),\n            (\"NETFLIX\", \"Expenses:Online:Netflix\"),\n        ],\n    ),\n```\n\n#### `CreditImporter`\n\n`CreditImporter` accepts a `description_patterns` argument, which should be a list of\n`(pattern, account)` tuples.\n\n##### Beancount 3.x\n\n```python\nfrom beancount_dkb import CreditImporter\nfrom beangulp import Ingest\n\nimporters = (\n    ECImporter(\n        \"9999 9999 9999 9999\",\n        \"Assets:DKB:EC\",\n        currency=\"EUR\",\n        payee_patterns=[\n            (\"REWE\", \"Expenses:Supermarket:REWE\"),\n            (\"NETFLIX\", \"Expenses:Online:Netflix\"),\n        ],\n    ),\n)\n\nif __name__ == \"__main__\":\n    ingest = Ingest(importer)\n    ingest()\n```\n\n##### Beancount 2.x\n\n```python\nCONFIG = [\n    CreditImporter(\n        CARD_NUMBER,\n        'Assets:DKB:Credit',\n        currency='EUR',\n        description_patterns=[\n            ('REWE', 'Expenses:Supermarket:REWE'),\n            ('NETFLIX', 'Expenses:Online:Netflix'),\n        ],\n    )\n```\n\n## Contributing\n\nContributions are most welcome!\n\nPlease make sure you have Python 3.9+ and [Poetry] installed.\n\n1. Clone the repository: `git clone https://github.com/siddhantgoel/beancount-dkb`\n2. Install the packages required for development: `poetry install`\n3. That's basically it. You should now be able to run the test suite: `poetry run task test`.\n\n[Beancount]: http://furius.ca/beancount/\n[DKB]: https://www.dkb.de\n[Poetry]: https://python-poetry.org/\n[changes documented here]: https://docs.google.com/document/d/1O42HgYQBQEna6YpobTqszSgTGnbRX7RdjmzR2xumfjs/edit#heading=h.hjzt0c6v8pfs\n[config file]: https://beancount.github.io/docs/importing_external_data.html#configuration\n[this guide]: https://beancount.github.io/docs/importing_external_data.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddhantgoel%2Fbeancount-dkb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiddhantgoel%2Fbeancount-dkb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddhantgoel%2Fbeancount-dkb/lists"}