Skip to main content

Beancount Importer for N26 CSV exports

Project description

Beancount N26 Importer

image image image Ruff

beancount-n26 provides a Beancount Importer for converting CSV exports of N26 account summaries to the Beancount format.

Installation

$ pip install beancount-n26

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.

Note that v1.x will only work with Beancount 3.x, while v0.x will only work with Beancount 2.x, due to incompatibilities between Beancount 3.x and 2.x.

Usage

Beancount 3.x

Beancount 3.x has replaced the config.py file based workflow in favor of having a script based workflow, as per the changes documented here. As a result, the importer's initialization parameters have been shifted to pyproject.toml.

Add the following to your pyproject.toml in your project root.

[tool.beancount-n26]
ibn = "IBAN_NUMBER" # required
account_name = "Assets:N26" # required
language = "en"
file_encoding = "utf-8"

Beancount 2.x

Add the following to your config.py.

from beancount_n26 import N26Importer

CONFIG = [
    N26Importer(
        IBAN_NUMBER,
        'Assets:N26',
        language='en',
        file_encoding='utf-8',
    ),
]

Classification

To classify specific recurring transactions automatically, you can specify an account_patterns parameter. The key should be the account name and the items in the list are regular expressions that should match a payee.

A few helper functions have been provided in beancount_n26/utils/patterns_generation.py to help you generate this dictionnary.

Beancount 3.x

[tool.beancount-n26.account_patterns]
"Expenses:Supermarket" = ["REWE", "ALDI"]

Beancount 2.x

from beancount_n26 import N26Importer

CONFIG = [
    N26Importer(
        ...
        account_patterns={"Expenses:Supermarket": ["REWE", "ALDI"]}
    ),
]

Multiple-currency transactions

To mark transaction fees associated with multiple-currency transactions, you can specify the exchange_fees_account parameter.

Beancount 3.x

[tool.beancount-n26]
ibn = "IBAN_NUMBER" # required
account_name = "Assets:N26" # required
language = "en"
file_encoding = "utf-8"
exchange_fees_account = "Expenses:TransferWise"

Beancount 2.x

from beancount_n26 import N26Importer

CONFIG = [
    N26Importer(
        IBAN_NUMBER,
        'Assets:N26',
        language='en',
        file_encoding='utf-8',
        exchange_fees_account='Expenses:TransferWise',
    ),
]

With this in place, for transactions where both the amount in EUR and amount in foreign currency are given, the importer will calculate the transaction fee based on the exchange rate included in the CSV export and automatically allocate the value to the account specified in exchange_fees_account.

Contributing

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

  1. Git clone the repository - git clone https://github.com/siddhantgoel/beancount-n26

  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 task test.

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

beancount_n26-1.2.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

beancount_n26-1.2.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file beancount_n26-1.2.0.tar.gz.

File metadata

  • Download URL: beancount_n26-1.2.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Darwin/24.0.0

File hashes

Hashes for beancount_n26-1.2.0.tar.gz
Algorithm Hash digest
SHA256 6446507ba6747169b1262807eff302ae91d0599279225b2e9a836e4e37ca70a6
MD5 bdbbf0d5806a26488b9ce00356da0efa
BLAKE2b-256 abbb8064feee26e1769e142def437de1d5770f80f1e3ece67d3a248795640c4c

See more details on using hashes here.

File details

Details for the file beancount_n26-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: beancount_n26-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Darwin/24.0.0

File hashes

Hashes for beancount_n26-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a572af3d0534b62bbc1ac315299d5816de3669faa1f05497b9d7b42a4d763a09
MD5 e3b3ea79bdd5037ca7f2a131e0cd0c17
BLAKE2b-256 7309ab16454288587c996c0e4df7ddf1ec62738487e1d649ef910a6db8d3d230

See more details on using hashes here.

Supported by

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