Skip to main content

The simple library for extracting all kind of bank account transaction export files, mostly for beanhub-import to inject and generate transactions

Project description

beanhub-extract

The simple library for extracting all kind of bank account transaction export files, mostly for beanhub-import to ingest and generate transactions

Why?

Have you ever wondered why each of us has to write our own different Beancount importers for the same bank again and again? Why we cannot use the same exporter for the same bank CSV file? One of the biggest problems of the original Beancount importer design is that the transaction generation logic is coupled with the extract logic, making it hard to reuse. We are addressing the problem by creating a library only for extracting bank-exported CSV files into standardized transaction structures to be processed later. Ideally, you should be able to import this library and use it to import standardized transactions from CSV files exported from any bank in the world.

Install

pip install beanhub-extract

Example

Extracting transactions from the CSV file is easy. Simply create the extractor class and make a function call on the instance object, which will return a transaction object generator. Like this:

from beanhub_extract.extractors.mercury import MercuryExtractor

with open("/path/to/my-mercury.csv", "rt") as fo:
    extractor = MercuryExtractor(fo)
    for txn in extractor():
        print(txn)
        # process your transaction here

Sponsor

BeanHub logo

A modern accounting book service based on the most popular open source version control system Git and text-based double entry accounting book software Beancount.

Transaction data object

We defined a standardized transaction data object to accommodate a transaction statement's most commonly used columns. The data object type is a simple immutable Python dataclasses.dataclass class. It's defined in the beanhub_extract/data_types.py file.

Supported Banks

Currently, we only support a few banks for our own benefit. If you find any particular bank CSV file or format missing and want this library to support it, please feel free to open a PR.

Mercury - mercury

To export the CSV file, please visit the Transactions page and click "Add Filter" to limit the time range of your export, then click the "Export All" button on the right-hand side.

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

beanhub_extract-0.0.6.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

beanhub_extract-0.0.6-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file beanhub_extract-0.0.6.tar.gz.

File metadata

  • Download URL: beanhub_extract-0.0.6.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1056-aws

File hashes

Hashes for beanhub_extract-0.0.6.tar.gz
Algorithm Hash digest
SHA256 ff7722349a0a6ee16f0c1710186edbe4173a6a07f9858215c7799fd93f5106f1
MD5 f312113b6ae08dbbeacd72e90e1a01fa
BLAKE2b-256 0747d8deacc6a4359e29d25b2f38ec9a1cdfdb0d7f0ff8357b635f04baee2ccd

See more details on using hashes here.

File details

Details for the file beanhub_extract-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: beanhub_extract-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1056-aws

File hashes

Hashes for beanhub_extract-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 eace3af8797c5fea8fa305c694310251dd53061279079154a5d65212be63a71d
MD5 cee230201dbee95f33b1a6dcded17a08
BLAKE2b-256 9eebd70cfc108d3c1c5bc28bda1f2cb134c6d1b951d173376eb59bd90790b0e8

See more details on using hashes here.

Supported by

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