Skip to main content

Import Mercury banking transactions into beancount format

Project description

beancount-v3-mercury

License

beancount-v3-mercury provides an Importer for converting CSV exports of Mercury checking transactions into Beancount format.

Installation

pip install beancount-v3-mercury
# or
uv add beancount-v3-mercury

Usage

Create an import script (e.g. import.py) as follows:

import beancount_mercury
from beangulp import Ingest

importers = [
    beancount_mercury.CheckingImporter(
        'Assets:Checking:Mercury',
        currency='USD',
        account_patterns={
          # These are example patterns. You can add your own.
          'Expenses:Cloud-Services:Source-Hosting:Github': ['GITHUB'],
          'Expenses:Postage:FedEx': ['Fedex'],
          'Expenses:Supermarket': ['REWE', 'ALDI'],
        }
    ),
]

if __name__ == '__main__':
    Ingest(importers).cli()

The account_patterns parameter is a dictionary mapping account names to lists of regex patterns. For each line in your Mercury CSV, CheckingImporter will attempt to create a matching posting on the transaction by matching the payee or narration to the regexes. Accounts are checked in dictionary order, with earlier accounts taking priority over later accounts.

Once this configuration is in place, you can extract transactions from a Mercury CSV export:

python import.py extract mercury-transactions.csv

Beancount v2 Compatibility

Although this package is designed for Beancount v3, it is also compatible with Beancount v2 since it depends on beancount>=2.3.5 and uses beangulp as the importer framework, which supports both versions.

Resources

See awesome-beancount for other publicly available Beancount importers.

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

beancount_v3_mercury-1.0.0.tar.gz (56.7 kB view details)

Uploaded Source

Built Distribution

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

beancount_v3_mercury-1.0.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file beancount_v3_mercury-1.0.0.tar.gz.

File metadata

File hashes

Hashes for beancount_v3_mercury-1.0.0.tar.gz
Algorithm Hash digest
SHA256 20deaa211e8294c5098e30833796b6aa3ab41d4ce1ce366851d38687e60d1bc0
MD5 3bff22e3be58348861c4db94469b6f96
BLAKE2b-256 78021698bbad3134f9da200237927b602a3d9a38e1acc093e5973f57b9c65004

See more details on using hashes here.

File details

Details for the file beancount_v3_mercury-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for beancount_v3_mercury-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b7d20eede3eecbd4b897a9d808b3b8af0c3d9bfe919399f88a985d22c4e7011
MD5 daf66a6de30768a83c9a3765d8f5825a
BLAKE2b-256 a1038271a81626733338624a3857b44297c33a18c57c08c52f877f7b758cdf4c

See more details on using hashes here.

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