OFXStatement plugin for french financial institutions like BanquePopulaire.
Project description
ofxstatement-french
This project provides custom ofxstatement plugin(s) for these french financial institutions:
- BanquePopulaire, France, PDF (https://www.banquepopulaire.fr/)
ofxstatement
is a tool to convert a proprietary bank statement to OFX
format, suitable for importing into programs like GnuCash or Beancount. The
plugin for ofxstatement parses the bank statement and produces a common data
structure, that is then formatted into an OFX file.
The PDF is converted using the pdftotext utility.
Financial institutions
BanquePopulaire
This bank allows you to download OFX files but only for transactions not older than 90 days. In order to read the transactions older than 90 days, you need to download a PDF from their site: Mon espace -> Mes documents électroniques -> Comptes / Epargne et placements. This utility can convert such a PDF to an OFX file.
Having a PDF is also useful for a visual verification but it is only generated every month, so you may need to download the OFX file now and then too for the actual status. There rests one problem: the OFX file generated by BanquePopulaire contains FITIDs not equal to the default FITID generated by this utility. So my solution is to download the OFX from BanquePopulaire regularly and the PDF every month. In the Configuration setup you can specify wildcards for the location of OFX files so that this utility will use the FITID from the (downloaded) OFX instead of its own default and hence any financial program will see the same transaction whether it is from the downloaded OFX or from the OFX created from the PDF. The OFX and PDF may also differ in some details like DATE, PAYEE and MEMO fields and this will be handled too by processing downloaded OFX files for their FITID.
Installation
Preconditions
You have to install the poppler library first, see pdftotext
Using pip
$ pip install ofxstatement-french
Development version from source
$ git clone https://github.com/gpaulissen/ofxstatement-french.git
$ pip install -e .
Troubleshooting
This package depends on ofxstatement with a version at least 0.6.5. This version may not yet be available in PyPI so install that from source like this:
$ git clone https://github.com/gpaulissen/ofxstatement.git
$ pip install -e .
Test
To run the tests from the development version you can use the py.test command:
$ py.test
You may need to install the required test packages first:
$ pip install -r test_requirements.txt
Usage
Show installed plugins
This shows the all installed plugins, not only those from this package:
$ ofxstatement list-plugins
You should see at least:
The following plugins are available:
...
fr-banquepopulaire BanquePopulaire, France, PDF (https://www.banquepopulaire.fr/)
...
Convert
Use something like this:
$ ofxstatement convert -t fr-banquepopulaire <file>.pdf <file>.ofx
Or you can convert the PDF yourself and supply the text as input:
$ pdftotext -layout <file>.pdf <file>.txt
$ ofxstatement convert -t fr-banquepopulaire <file>.txt <file>.ofx
See also the section configuration below.
Configuration
For BanquePopulaire you may download their OFX files and use them to provide you with their OFX FITID numbers instead of relying on FITID numbers generated by the ofxstatement tool. You can specifiy the OFX files to read first using the ofxstatement configuration. The OFX files configuration is a comma separated list of wildcard specifications relative to the PDF to convert.
You may also need to set a bank id, since the statement files do not always contain bank information like the BIC code in this line:
IBAN FR99 9999 9999 9999 9999 9999 999 BIC CCBPFRPPBDX *** C A S D E N-B P ***
$ ofxstatement edit-config
This is a sample configuration (do not forget to specify the plugin for each section):
[banquepopulaire]
plugin = fr-banquepopulaire
ofx_files = *.ofx, ../*.ofx
bank_id = CCBPFRPPBDX
Now this statement will convert .pdf downloaded from BanquePopulaire (Mon Espace -> Mes documents électroniques -> Comptes) to .ofx while using the FITIDs found in the *.ofx files in the directory of .pdf or in its parent directory.
$ ofxstatement convert -t banquepopulaire <file>.pdf <file>.ofx
Change history
See the Changelog (CHANGELOG.md).
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
[1.4.1] - 2022-02-23
Changed
- The plugin ofx_files which is a list of file specifications is checked for containing files
[1.4.0] - 2021-01-18
Added
- Ability to set the bank id in the configuration.
[1.3.1] - 2020-05-23
Changed
- In case a transaction is duplicated (in several files), the latest transaction and thus FITID read will prevail. A transaction key is composed of ACCTID, CHECKNUM, DTPOSTED, TRNAMT and NAME (either CHECKNUM or NAME is empty).
[1.3.0] - 2020-05-23
Changed
- Replaced the ofxparse library by beautifulsoup4 since the former does only read one bank account and a BanquePopulaire OFX file may contain several bank accounts (conform the OFX standard).
- The ofx_files configuration may be a list of comma separated file name specifications instead of just one file name specification.
- The ofx_files cache will provide the OFX FITID for PDF statement line ID if there is a match on any of the three dates (DATE COMPTA, DATE OPERATION, DATE VALEUR) in the PDF. Usually DATE COMPTA is equal to DTPOSTED from the OFX, but not always.
- The ofx_files cache will provide the PAYEE and MEMO fields if there is a match since BanquePopulaire does not necessarily show the same values for the same transaction in a PDF and OFX file.
[1.2.0] - 2020-05-02
Changed
- Added the ability to retrieve the OFX id (FITID) from OFX files downloaded from BanquePopulaire instead of using an id generated by the ofxstatement tool.
[1.1.1] - 2020-03-23
Changed
- The generation af a unique OFX id did only return a counter in case of duplicates
- The Readme mentions now my fork of the ofxstatement instead of https://github.com/kedder/ofxstatement.git
- The about.py file outputs the version number and that is used in the Makefile
- The Makefile depends now on GNU make for tagging a release
[1.1.0] - 2020-03-22
Added
- This Changelog
- The Readme mentions test_requirements.txt for installing test modules
- More checks concerning the content (dates with start and end date exclusive) that may result in a ValidationError exception
- Casden accounts also supported
- Negative balances recognized
- Added Makefile for keeping the important operations together
Changed
- The date will now be the accounting date (DATE COMPTA) instead of operation date (DATE OPERATION).
- Handling of 29 february improved
- Improved handling of graphics in the PDF which transforms to a description starting with F and whitespace.
- The BIC is also recognized if the line does not end with a BIC followed by only whitespace (hence BIC<.+> is now allowed)
- Better determination of the statement header.
[1.0.0] - 2020-03-16
Added
- Converting the French BanquePopulaire PDFs to an OFX file.
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
File details
Details for the file ofxstatement-french-1.4.1.tar.gz
.
File metadata
- Download URL: ofxstatement-french-1.4.1.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14634b64a31cab0c209be5a2ebc5202e61b0b60e4c0156210cd36f6a57c202bd |
|
MD5 | 9dc959e7ba29bc07e9260c36e5385c50 |
|
BLAKE2b-256 | 0b4a699aa1b4393d3fc11a36aeb1a1d60adfb19985845e9367ee9aab9a16477b |
File details
Details for the file ofxstatement_french-1.4.1-py3-none-any.whl
.
File metadata
- Download URL: ofxstatement_french-1.4.1-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b2b03c46694b8d4408418f515b8b6f6b7c31246f43c511d39c9f117fb5fe96a |
|
MD5 | 551891ad6f6af83ea2e2fd11a7328e25 |
|
BLAKE2b-256 | aa9ef7d6eab7775628a2b78fc93b21238d7ba921634728d759906f32dab611bf |