beancount-n26
provides a Beancount Importer for converting CSV exports of
N26 account summaries to the Beancount format.
$ 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.
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"
Add the following to your config.py
.
from beancount_n26 import N26Importer
CONFIG = [
N26Importer(
IBAN_NUMBER,
'Assets:N26',
language='en',
file_encoding='utf-8',
),
]
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.
[tool.beancount-n26.account_patterns]
"Expenses:Supermarket" = ["REWE", "ALDI"]
from beancount_n26 import N26Importer
CONFIG = [
N26Importer(
...
account_patterns={"Expenses:Supermarket": ["REWE", "ALDI"]}
),
]
To mark transaction fees associated with multiple-currency transactions, you can
specify the exchange_fees_account
parameter.
[tool.beancount-n26]
ibn = "IBAN_NUMBER" # required
account_name = "Assets:N26" # required
language = "en"
file_encoding = "utf-8"
exchange_fees_account = "Expenses:TransferWise"
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
.
Please make sure you have Python 3.8+ and Poetry installed.
-
Git clone the repository -
git clone https://github.com/siddhantgoel/beancount-n26
-
Install the packages required for development -
poetry install
-
That's basically it. You should now be able to run the test suite -
poetry run task test
.