bankstatementparser-writer-swift
SWIFT MT940 & MT942 financial statement exporter plugin for bankstatementparser.
Contents
- What is bankstatementparser-writer-swift? — the problem it solves
- Install — PyPI, virtualenv
- Quick start — export statements to MT940 / MT942 in three lines
- Public API —
to_mt940,to_mt942,write_mt940,write_mt942 - SWIFT Tag Specification — standard MT tag generation
- Development — quality gates, tests
- Ecosystem — modular package suite
- Contributing
- License
What is bankstatementparser-writer-swift?
SWIFT MT940 (Customer Statement Message) and MT942 (Interim Transaction Report) are the industry standard telecommunication messages used across correspondent banking and corporate treasury management.
bankstatementparser-writer-swift serializes parsed transaction datasets back into standard SWIFT MT940 and MT942 message formats with strict field formatting.
| Concern | How this writer handles it |
|---|---|
| Input Flexibility | Accepts list[Transaction], pandas.DataFrame, or list[dict] |
| Tags Generated | Produces :20: (TRN), :25: (Account), :28C: (Statement/Seq), :60F:/:62F: (Balances), :61: (Statement Line), :86: (Narrative) |
| Tag :61: Formatting | Formats YYMMDD, Debit/Credit marker (D/C), Currency, Amount, Transaction Type (NTRN), and Reference |
| Balance Calculations | Automatically computes opening and closing balances from transaction stream |
Install
| Channel | Command | Notes |
|---|---|---|
| PyPI | pip install bankstatementparser-writer-swift |
Pulls in bankstatementparser >= 0.0.34 |
| Source | git clone https://github.com/sebastienrousseau/bankstatementparser-writer-swift && cd bankstatementparser-writer-swift && poetry install |
For local development |
Requires Python 3.10 or later. Compatible with macOS, Linux, and Windows.
Using an isolated virtual environment (recommended)
python -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windows
python -m pip install -U bankstatementparser-writer-swift
Quick start
from bankstatementparser_writer_swift import write_mt940, write_mt942
from bankstatementparser import create_parser
# 1. Parse statement
parser = create_parser("statement.camt")
transactions = parser.to_transactions()
# 2. Export to standard SWIFT MT940 text document
write_mt940(
transactions,
"statement.mt940",
account_id="FR7630006000011234567890189",
currency="EUR",
)
Public API
to_mt940(data: Any, account_id: str, currency: str = "EUR", opening_balance: Decimal = Decimal("0.00")) -> str: Serializes transactions to MT940 text.write_mt940(data: Any, output_path: str | Path, account_id: str, currency: str = "EUR") -> Path: Writes MT940 to file.to_mt942(data: Any, account_id: str, currency: str = "EUR") -> str: Serializes transactions to MT942 interim report.write_mt942(data: Any, output_path: str | Path, account_id: str, currency: str = "EUR") -> Path: Writes MT942 to file.
Development
The project enforces strict code-quality gates: 100% test and branch coverage, strict type annotations (mypy), style linting (ruff), docstring coverage (interrogate), and security scanning (bandit).
# Run test suite with branch coverage enforcement
poetry run pytest
# Type checking and linting
poetry run mypy .
poetry run ruff check .
poetry run ruff format --check .
# Documentation and security gates
poetry run interrogate -v
poetry run bandit -r . -c pyproject.toml
Ecosystem
bankstatementparser is part of a modular financial ecosystem. Optional companion packages provide specialized loaders, writers, AI agents, language servers, and transport protocol adapters:
| Package | GitHub Repository | PyPI | Role | Description |
|---|---|---|---|---|
bankstatementparser |
sebastienrousseau/bankstatementparser |
Core Engine | Unified parser for CAMT (052/053), PAIN.001, CSV, OFX, QFX, MT940, and PDF statements | |
bankstatementparser-mcp |
sebastienrousseau/bankstatementparser-mcp |
AI Protocol | Model Context Protocol (MCP) server exposing statement tools to LLMs & AI agents | |
bankstatementparser-lsp |
sebastienrousseau/bankstatementparser-lsp |
Developer Tooling | Language Server Protocol (LSP) with live SWIFT MT940 statement validation & diagnostics | |
bankstatementparser-transport-ebics |
sebastienrousseau/bankstatementparser-transport-ebics |
Transport | Automated bank statement retrieval over EBICS 3.0 (H005) and 2.5 (H004) protocols |
|
bankstatementparser-writer-xlsx |
sebastienrousseau/bankstatementparser-writer-xlsx |
Output Writer | Formats and exports parsed banking transactions into styled Microsoft Excel (.xlsx) workbooks |
|
bankstatementparser-writer-qif |
sebastienrousseau/bankstatementparser-writer-qif |
Output Writer | Serializes transactions into standard Quicken Interchange Format (.qif) exchange files |
|
bankstatementparser-writer-ofx |
sebastienrousseau/bankstatementparser-writer-ofx |
Output Writer | Serializes transactions into standard Open Financial Exchange (.ofx) XML/SGML files |
|
bankstatementparser-writer-swift |
sebastienrousseau/bankstatementparser-writer-swift |
Output Writer | Exports transactions to SWIFT MT940 customer statements and MT942 interim reports | |
bankstatementparser-loader-bai2 |
sebastienrousseau/bankstatementparser-loader-bai2 |
Input Loader | Parses BAI2 cash-management and account balance statements | |
bankstatementparser-loader-mt942 |
sebastienrousseau/bankstatementparser-loader-mt942 |
Input Loader | Parses SWIFT MT942 interim transaction reports with credit/debit summary reconciliation | |
bankstatementparser-loader-cfonb |
sebastienrousseau/bankstatementparser-loader-cfonb |
Input Loader | Parses French CFONB 120 / AFB120 120-byte fixed-width banking statement files | |
bankstatementparser-loader-camt054 |
sebastienrousseau/bankstatementparser-loader-camt054 |
Input Loader | Ingests ISO 20022 CAMT.054 real-time debit/credit notification stream XML | |
bankstatementparser-loader-sepa |
sebastienrousseau/bankstatementparser-loader-sepa |
Input Loader | Ingests ISO 20022 SEPA PAIN.002 payment status reports and PAIN.008 direct debit mandates | |
bankstatementparser-loader-bacs |
sebastienrousseau/bankstatementparser-loader-bacs |
Input Loader | Parses UK BACS Standard 18 / Faster Payments 106-byte fixed-width transmission files |
Contributing
Contributions are welcome! Please submit an issue or pull request on GitHub. Ensure that all quality gates pass and test coverage remains at 100%.
License
This project is dual-licensed under the Apache License 2.0 and the MIT License. See LICENSE-APACHE and LICENSE-MIT for full details.
Metadata
Release files for bankstatementparser-writer-swift 0.0.35
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bankstatementparser_writer_swift-0.0.35.tar.gz | 11.6 kB | With provenance | Details for bankstatementparser_writer_swift-0.0.35.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bankstatementparser_writer_swift-0.0.35-py3-none-any.whl | Python 3 | none | any | Details for bankstatementparser_writer_swift-0.0.35-py3-none-any.whl |
Total release size: 24.8 kB
Release files / bankstatementparser_writer_swift-0.0.35.tar.gz
| Download URL | bankstatementparser_writer_swift-0.0.35.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b6e6a2d8cd1cb94eb939ce254f8fbc38496b910154ffc90646ce296a75d50e2
|
|
BLAKE2b-256 checksum How to use checksums |
eeed53e1408d2b05ca7578a2ed6a803e200b23d2bf515dbdd37758b409649d39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / bankstatementparser_writer_swift-0.0.35-py3-none-any.whl
| Download URL | bankstatementparser_writer_swift-0.0.35-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10113d251a7e809533845e517cdd42ca8ba8f2996f0f022bd62885b6901b2d18
|
|
BLAKE2b-256 checksum How to use checksums |
34ed6d87fe392f09eaab1d2648b72efb11e206dd2a9b24384213dbe110119ada
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for bankstatementparser-writer-swift 0.0.35
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for bankstatementparser_writer_swift-0.0.35.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.