Skip to content

Commit

Permalink
script now only uses the first 4 digits of the bic (for the unique ba…
Browse files Browse the repository at this point in the history
…nk code)
  • Loading branch information
ma4nn committed Jan 14, 2024
1 parent 690cb12 commit d47eec8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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".

Expand Down
3 changes: 3 additions & 0 deletions moneymoney_sum_by_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]])
Expand Down

0 comments on commit d47eec8

Please sign in to comment.