From d47eec85da3221d3044de23c4a06598b3a5df0e7 Mon Sep 17 00:00:00 2001 From: Christoph Massmann Date: Sun, 14 Jan 2024 10:42:16 +0100 Subject: [PATCH] script now only uses the first 4 digits of the bic (for the unique bank code) --- README.md | 3 ++- moneymoney_sum_by_bank.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c613ece..486ccd7 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ python3 moneymoney_sum_by_bank.py **Note:** The MoneyMoney application has to be unlocked when executing the script otherwise an error will be thrown. -This Python script sums all account balances from MoneyMoney by BIC. If a BIC is not available (e.g. in case of an offline or a credit card account), +This Python script sums all account balances from MoneyMoney by the bank code of the BIC ([first 4 digits](https://www.buchhaltung-einfach-sicher.de/finanzen/bic)). +If a BIC is not available (e.g. in case of an offline or a credit card account), the script looks for a custom attribute `bankIdentifier` in the account settings and uses this as reference. If neither of this information is available on the account and it has a balance, the value is added to "other". diff --git a/moneymoney_sum_by_bank.py b/moneymoney_sum_by_bank.py index a7a52f1..6efd42a 100644 --- a/moneymoney_sum_by_bank.py +++ b/moneymoney_sum_by_bank.py @@ -17,6 +17,9 @@ def sum_by_account(accounts: list[Account]) -> pd.DataFrame: if not account['bankCode']: account['bankCode'] = account['attributes']['bankIdentifier'] if 'bankIdentifier' in account['attributes'] else 'other' logging.debug("Account %s has no bank code, using '%s'", account["name"], account['bankCode']) + else: + # we only take the first 4 characters of the bic as that is the bank code, @see https://www.buchhaltung-einfach-sicher.de/finanzen/bic + account['bankCode'] = account['bankCode'][:4] for balance in account['balance']: balance_per_bank_and_currency.append([account['bankCode'], balance[0], balance[1]])