ofxstatement plugin for German bank Sparkasse Freiburg-Nördlicher Breisgau
Project description
ofxstatement plugin for Sparkasse Freiburg-Nördlicher Breisgau
This is an ofxstatement plugin for the German bank Sparkasse Freiburg-Nördlicher Breisgau (short: Sparkasse Freiburg).
This plugin has no affiliation with or endorsement by Sparkasse Freiburg-Nördlicher Breisgau. The only reason for using the name is to aid people looking for a tool to convert that bank's CSV transaction exports to OFX.
ofxstatement is a tool to convert proprietary bank statement to OFX format, suitable for importing to GnuCash. Plugin for ofxstatement parses a particular proprietary bank statement format and produces common data structure, that is then formatted into an OFX file.
Users of ofxstatement have developed several plugins for their banks. They are listed on the main ofxstatement site. If your bank is missing, you can develop your own plugin.
Usage
To use this plugin install it. For example:
pip3 install --user ofxstatement-sparkasse-freiburg
Edit the configuration:
ofxstatement edit-config
Add something like this:
[sparkasse_freiburg]
plugin = germany_sparkasse_freiburg
account = 123456789
account is you bank account number (Kontonummer).
Other possible settings are:
- encoding: The encoding of the CSV file (default is Windows 1252 ANSI: cp1252)
Then download the CSV files (CSV-CAMT format) from you online banking account and convert it as follows:
ofxstatement convert -t sparkasse_freiburg EXAMPLE.csv EXAMPLE.ofx
The resulting .ofx file can then be imported in gnuCash or similar software.
Note: Beware that some things (such as balance calculation) were left out because they are not needed by gnuCash. Open a ticket or send a pull request if something is missing for your use case.
Development
It is recommended to use virtualenv to make a clean development environment.
git clone https://github.com/omarkohl/ofxstatement-sparkasse-freiburg
cd ofxstatement-sparkasse-freiburg
make venv
source .venv/bin/activate
This will download all the dependencies and install them into your virtual environment. After this, you should be able to do::
ofxstatement list-plugins
Expected output:
The following plugins are available:
germany_sparkasse_freiburg Plugin for German bank Sparkasse Freiburg
Tests
Execute:
make test
Integration tests
Part of the tests are integration (or end to end) tests that test the complete conversion from CSV to OFX files. You can find these files under tests/data . Every .csv file is verified to be converted to the corresponding .ofx file. Additionally the -pretty.xml files contain a pretty version of the resulting OFX (which actually is just XML).
To add a new .csv example simply include it in said directory and edit
tests/test_integration.py . Set OVERWRITE_EXPECTED_FILES
to True
and then
execute the tests. Commit the content of tests/data .
Since unfortunately the ofxstatement config is a global file with no option to pass in another path the integration tests overwrite this file before each test and then restore it. This is done using a pytest fixture. Running integration tests and any other ofxstatement operation at the same time with the same user on the same system is therefore a bad idea.
Improvements
In general the plugin tries to be simple and not convert any values that are currently not needed. If something is missing feel free to open an issue or even better send a pull requests.
Some things which may be worth modifying:
- The bank_id is currently hardcoded to Sparkasse Freiburg's BIC
- The currency of the account is also hardcoded to EUR
- The StatementLine.id (becomes OFX's FITID) is calculated by hashing date, payee, memo and amount and then truncated. FITID should always be unique for the entire account history to detect transaction duplicates.
- OFX's NAME field (.payee in the code) is made out of the sender/receiver + the subject (Verwendungszweck). This could be made configurable.
- OFX's MEMO field (.memo in the code) is made out of Buchungstext, Kontonummer and BIC.
- trntype is currently only ever set to DEBIT or CREDIT. Using 'Buchungstext' it could be improved.
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
Hashes for ofxstatement-sparkasse-freiburg-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 761a88899080fee6ad18a6b320b83b916ed8c2c03eb8c815916f0a478948f37b |
|
MD5 | 30e970f8eaca5430d279fbc9a7c429ec |
|
BLAKE2b-256 | fce4ce71acc4c5788aff2f6b9dedc3769e75e703452c334d7fcf5c33be14bb9a |
Hashes for ofxstatement_sparkasse_freiburg-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f4b63849481cc1cca50f3942d2f8e00f7cc81921e9f90733b14212251ce93d1 |
|
MD5 | df0750a30248154b95262c2bfd19f261 |
|
BLAKE2b-256 | f7fb050f8edff37ead0d7b41858e9004fd05bca109383e75563bf804506d40d2 |