Skip to main content

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 //) as mt940_ref: metadata. extract() skips references already present anywhere in the existing ledger — re-running an import is always safe.
  • Emits a balance assertion 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_rules draft 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beangulp_mt940-0.1.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

beangulp_mt940-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

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

Hashes for beangulp_mt940-0.1.0.tar.gz
Algorithm Hash digest
SHA256 263433b9efb255dd0ffd28e14d4187b5ac6d15edaf0aa1224f26a694d0b40762
MD5 50b01101aaffd47ba469ada41cfbc425
BLAKE2b-256 4339d52a31fa1e8d27ac790183b383a600826a30d8de407d7324461de95ec121

See more details on using hashes here.

Provenance

The following attestation bundles were made for beangulp_mt940-0.1.0.tar.gz:

Publisher: publish.yaml on sealambda/quints

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for beangulp_mt940-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d348eacb8013380da262de1ca59633474b8beee0a102e16a762dfbf604002b59
MD5 0008d7ce2f5fab55afeb69c48b20e401
BLAKE2b-256 5b42267b09f17dd9bce46bf271e3a0f56e0dd92e14eeeb7b69f4c15b4cfaddca

See more details on using hashes here.

Provenance

The following attestation bundles were made for beangulp_mt940-0.1.0-py3-none-any.whl:

Publisher: publish.yaml on sealambda/quints

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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