beangulp importer for SWIFT MT940 bank statements (UBS et al.): drafts transactions with stable bank references for idempotent re-imports, plus closing-balance assertions
Project description
beangulp-mt940
beangulp importer for SWIFT MT940
bank statements (tested against UBS Switzerland exports), built on the
mt-940 parser.
What it does
- Drafts one beancount transaction per
:61:statement line, with the bank's unique entry reference (the part after//) asmt940_ref:metadata.extract()skips references already present anywhere in the existing ledger — re-running an import is always safe. - Emits a
balanceassertion from the:62F:closing balance, dated the day after (beancount balances are beginning-of-day). - Skips zero-amount noise entries (e.g. UBS "Balance closing of service prices").
- Optional
payee_rulesdraft the counter leg: an iterable of(regex, account, flag)matched case-insensitively against the payee and the full:86:details. Unmatched entries keep the!review flag and the cash leg only — classification, VAT treatment, and document evidence stay a human decision.
Usage
from beangulp_mt940 import Importer
importer = Importer(
"Assets:Bank:Checking",
iban="CH93 0076 2011 6238 5295 7", # identify() filter, optional
payee_rules=(
(r"client ag", "Assets:Receivable", "*"),
(r"hosting", "Expenses:IT:Hosting", "!"),
),
)
entries = importer.extract("statement.mt940", existing=ledger_entries)
Works standalone (as above) or as a regular importer in a beangulp
import_config.py.
Notes on UBS specifics
- UBS puts the counterparty in
:86:after a transaction code and?(DE1?Google Workspace …); the importer's payee heuristic handles both this and plain details. - The supplementary line under
:61:("Debit card payment", "e-banking credit", …) becomes the narration. - Transaction dates use the value date; the entry (booking) date is available in the source if you need it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file beangulp_mt940-0.1.0.tar.gz.
File metadata
- Download URL: beangulp_mt940-0.1.0.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
263433b9efb255dd0ffd28e14d4187b5ac6d15edaf0aa1224f26a694d0b40762
|
|
| MD5 |
50b01101aaffd47ba469ada41cfbc425
|
|
| BLAKE2b-256 |
4339d52a31fa1e8d27ac790183b383a600826a30d8de407d7324461de95ec121
|
Provenance
The following attestation bundles were made for beangulp_mt940-0.1.0.tar.gz:
Publisher:
publish.yaml on sealambda/quints
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
beangulp_mt940-0.1.0.tar.gz -
Subject digest:
263433b9efb255dd0ffd28e14d4187b5ac6d15edaf0aa1224f26a694d0b40762 - Sigstore transparency entry: 2171959645
- Sigstore integration time:
-
Permalink:
sealambda/quints@30e87656f2bb4279b75f3201a708dea77ae1f80c -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sealambda
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@30e87656f2bb4279b75f3201a708dea77ae1f80c -
Trigger Event:
push
-
Statement type:
File details
Details for the file beangulp_mt940-0.1.0-py3-none-any.whl.
File metadata
- Download URL: beangulp_mt940-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d348eacb8013380da262de1ca59633474b8beee0a102e16a762dfbf604002b59
|
|
| MD5 |
0008d7ce2f5fab55afeb69c48b20e401
|
|
| BLAKE2b-256 |
5b42267b09f17dd9bce46bf271e3a0f56e0dd92e14eeeb7b69f4c15b4cfaddca
|
Provenance
The following attestation bundles were made for beangulp_mt940-0.1.0-py3-none-any.whl:
Publisher:
publish.yaml on sealambda/quints
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
beangulp_mt940-0.1.0-py3-none-any.whl -
Subject digest:
d348eacb8013380da262de1ca59633474b8beee0a102e16a762dfbf604002b59 - Sigstore transparency entry: 2171959665
- Sigstore integration time:
-
Permalink:
sealambda/quints@30e87656f2bb4279b75f3201a708dea77ae1f80c -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sealambda
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@30e87656f2bb4279b75f3201a708dea77ae1f80c -
Trigger Event:
push
-
Statement type: