beancount-dkb


Namebeancount-dkb JSON
Version 0.19.0 PyPI version JSON
download
home_pagehttps://github.com/siddhantgoel/beancount-dkb
SummaryBeancount Importer for DKB CSV exports
upload_time2024-03-08 06:32:17
maintainer
docs_urlNone
authorSiddhant Goel
requires_python>=3.8,<4.0
licenseMIT
keywords banking beancount cli-accounting finance
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Beancount DKB Importer

[![image](https://github.com/siddhantgoel/beancount-dkb/workflows/beancount-dkb/badge.svg)](https://github.com/siddhantgoel/beancount-dkb/workflows/beancount-dkb/badge.svg)

[![image](https://img.shields.io/pypi/v/beancount-dkb.svg)](https://pypi.python.org/pypi/beancount-dkb)

[![image](https://img.shields.io/pypi/pyversions/beancount-dkb.svg)](https://pypi.python.org/pypi/beancount-dkb)

[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

`beancount-dkb` provides an Importer for converting CSV exports of [DKB]
(Deutsche Kreditbank) account summaries to the [Beancount] format.

## Installation

```sh
$ pip install beancount-dkb
```

In case you prefer installing from the Github repository, please note that
`main` is the development branch so `stable` is what you should be installing
from.

## Usage

If you're not familiar with how to import external data into Beancount, please
read [this guide] first.

Adjust your [config file] to include `ECImporter` and `CreditImporter`
(depending on what account you're trying to import).

A sample configuration might look like the following:

```python
from beancount_dkb import ECImporter, CreditImporter

IBAN_NUMBER = 'DE99 9999 9999 9999 9999 99' # your real IBAN number

CARD_NUMBER = '9999 9999 9999 9999'         # your real Credit Card number

CONFIG = [
    ECImporter(
        IBAN_NUMBER,
        'Assets:DKB:EC',
        currency='EUR',
    ),

    CreditImporter(
        CARD_NUMBER,
        'Assets:DKB:Credit',
        currency='EUR',
    )
]
```

Once this is in place, you should be able to run `bean-extract` on the command
line to extract the transactions and pipe all of them into your Beancount file.

```sh
$ bean-extract /path/to/config.py transaction.csv >> you.beancount
```

### Transaction Codes as Meta Tags

By default, the ECImporter prepends the transaction code ("Buchungstext") to the
transaction description. To achieve shorter descriptions and use meta tags to
query for certain transaction codes, the importer may be configured to store the
transaction code in a user provided meta tag.

The following configuration instructs the importer to use a meta tag `code` to
store transaction codes:

```python
...
CONFIG = [
    ECImporter(
        IBAN_NUMBER,
        'Assets:DKB:EC',
        currency='EUR',
        meta_code='code',
    ),
...

```

This is how an example transaction looks without the option:

```beancount
2021-03-01 * "Kartenzahlung" "XY Supermarket"
    Assets:DKB:EC                        -133.72 EUR
```

And this is the resulting transaction using `meta_code='code'`

```beancount
2021-03-01 * "XY Supermarket"
    code: Kartenzahlung
    Assets:DKB:EC                        -133.72 EUR
```

### Pattern-matching Transactions

It's possible to give the importer classes hints if you'd like them to include a
second posting based on specific characteristics of the original transaction.

For instance, if the payee or the description in a transaction always matches a
certain value, it's possible to tell the `ECImporter` or `CreditImporter` to
automatically place a second posting in the returned lits of transactions.

#### `ECImporter`

`ECImporter` accepts a `payee_patterns` argument, which should be a list of
`(pattern, account)` tuples.

```python
CONFIG = [
    ECImporter(
        IBAN_NUMBER,
        'Assets:DKB:EC',
        currency='EUR',
        payee_patterns=[
            ('REWE Filialen', 'Expenses:Supermarket:REWE'),
            ('NETFLIX', 'Expenses:Online:Netflix'),
        ],
    ),
```

#### `CreditImporter`

`CreditImporter` accepts a `description_patterns` argument, which should be a
list of `(pattern, account)` tuples.

```python
CONFIG = [
    CreditImporter(
        CARD_NUMBER,
        'Assets:DKB:Credit',
        currency='EUR',
        description_patterns=[
            ('REWE sagt Danke', 'Expenses:Supermarket:REWE'),
            ('NETFLIX', 'Expenses:Online:Netflix'),
        ],
    )
```

## Contributing

Contributions are most welcome!

Please make sure you have Python 3.8+ and [Poetry] installed.

1. Clone the repository: `git clone https://github.com/siddhantgoel/beancount-dkb`
2. Install the packages required for development: `poetry install`
3. That's basically it. You should now be able to run the test suite: `poetry run py.test`.

[Beancount]: http://furius.ca/beancount/
[config file]: https://beancount.github.io/docs/importing_external_data.html#configuration
[DKB]: https://www.dkb.de
[Poetry]: https://python-poetry.org/
[this guide]: https://beancount.github.io/docs/importing_external_data.html

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/siddhantgoel/beancount-dkb",
    "name": "beancount-dkb",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "banking,beancount,cli-accounting,finance",
    "author": "Siddhant Goel",
    "author_email": "me@sgoel.dev",
    "download_url": "https://files.pythonhosted.org/packages/e0/91/e82becaa8ec5a837c8b7e61a6b872ae38ac3fa036511e844a31337c09269/beancount_dkb-0.19.0.tar.gz",
    "platform": null,
    "description": "# Beancount DKB Importer\n\n[![image](https://github.com/siddhantgoel/beancount-dkb/workflows/beancount-dkb/badge.svg)](https://github.com/siddhantgoel/beancount-dkb/workflows/beancount-dkb/badge.svg)\n\n[![image](https://img.shields.io/pypi/v/beancount-dkb.svg)](https://pypi.python.org/pypi/beancount-dkb)\n\n[![image](https://img.shields.io/pypi/pyversions/beancount-dkb.svg)](https://pypi.python.org/pypi/beancount-dkb)\n\n[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n`beancount-dkb` provides an Importer for converting CSV exports of [DKB]\n(Deutsche Kreditbank) 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\n`main` is the development branch so `stable` is what you should be installing\nfrom.\n\n## Usage\n\nIf you're not familiar with how to import external data into Beancount, please\nread [this guide] first.\n\nAdjust your [config file] to include `ECImporter` and `CreditImporter`\n(depending on what account you're trying to import).\n\nA sample configuration might look like the following:\n\n```python\nfrom beancount_dkb import ECImporter, CreditImporter\n\nIBAN_NUMBER = 'DE99 9999 9999 9999 9999 99' # your real IBAN number\n\nCARD_NUMBER = '9999 9999 9999 9999'         # your real Credit Card number\n\nCONFIG = [\n    ECImporter(\n        IBAN_NUMBER,\n        'Assets:DKB:EC',\n        currency='EUR',\n    ),\n\n    CreditImporter(\n        CARD_NUMBER,\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 >> 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\nquery for certain transaction codes, the importer may be configured to store the\ntransaction code in a user provided meta tag.\n\nThe following configuration instructs the importer to use a meta tag `code` to\nstore transaction codes:\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```\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 a `payee_patterns` argument, which should be a list of\n`(pattern, account)` tuples.\n\n```python\nCONFIG = [\n    ECImporter(\n        IBAN_NUMBER,\n        'Assets:DKB:EC',\n        currency='EUR',\n        payee_patterns=[\n            ('REWE Filialen', '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\nlist of `(pattern, account)` tuples.\n\n```python\nCONFIG = [\n    CreditImporter(\n        CARD_NUMBER,\n        'Assets:DKB:Credit',\n        currency='EUR',\n        description_patterns=[\n            ('REWE sagt Danke', '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.8+ 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 py.test`.\n\n[Beancount]: http://furius.ca/beancount/\n[config file]: https://beancount.github.io/docs/importing_external_data.html#configuration\n[DKB]: https://www.dkb.de\n[Poetry]: https://python-poetry.org/\n[this guide]: https://beancount.github.io/docs/importing_external_data.html\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Beancount Importer for DKB CSV exports",
    "version": "0.19.0",
    "project_urls": {
        "Homepage": "https://github.com/siddhantgoel/beancount-dkb",
        "Repository": "https://github.com/siddhantgoel/beancount-dkb"
    },
    "split_keywords": [
        "banking",
        "beancount",
        "cli-accounting",
        "finance"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "219c828baecb9147ad460909fdb62f78bcc54f0a0bda7461fe0518a42855425b",
                "md5": "f885bbe2fd2df8c8057feb0f42726d9d",
                "sha256": "cfe7e330200312cd8c8f2108c92f89cac84d1421551300ae71089abfd1ebd966"
            },
            "downloads": -1,
            "filename": "beancount_dkb-0.19.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f885bbe2fd2df8c8057feb0f42726d9d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 14455,
            "upload_time": "2024-03-08T06:32:15",
            "upload_time_iso_8601": "2024-03-08T06:32:15.864707Z",
            "url": "https://files.pythonhosted.org/packages/21/9c/828baecb9147ad460909fdb62f78bcc54f0a0bda7461fe0518a42855425b/beancount_dkb-0.19.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e091e82becaa8ec5a837c8b7e61a6b872ae38ac3fa036511e844a31337c09269",
                "md5": "6a39c08e35fc01150524892429ca04c8",
                "sha256": "187aba0fdc6fe1a457028445f47d7a1028db390cf6bd2449d4fdfa0eed84eb22"
            },
            "downloads": -1,
            "filename": "beancount_dkb-0.19.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6a39c08e35fc01150524892429ca04c8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 9892,
            "upload_time": "2024-03-08T06:32:17",
            "upload_time_iso_8601": "2024-03-08T06:32:17.941192Z",
            "url": "https://files.pythonhosted.org/packages/e0/91/e82becaa8ec5a837c8b7e61a6b872ae38ac3fa036511e844a31337c09269/beancount_dkb-0.19.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-08 06:32:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "siddhantgoel",
    "github_project": "beancount-dkb",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "beancount-dkb"
}
        
Elapsed time: 0.22675s