Package: ofxstatement-mt940
ofxstatement-mt940This project provides a customofxstatementplugin for
financial institutions providing MT940 statements.ofxstatementis 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.See also theMT940project. Without that
project this plugin would not have been possible.InstallationUsing pip$ pip install ofxstatement-mt940Development version from source$ git clone https://github.com/gpaulissen/ofxstatement-mt940.git
$ pip install -e .TroubleshootingThis 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 .TestTo run the tests from the development version you can use the py.test command:$ py.testYou may need to install the required test packages first:$ pip install -r test_requirements.txtUsageShow installed pluginsThis shows the all installed plugins, not only those from this package:$ ofxstatement list-pluginsYou should see at least:The following plugins are available:

  ...
  mt940            MT940, text
  ...ConvertThis will convert a mt940 file to an OFX file.$ ofxstatement convert -t mt940 mt940.txt mt940.ofxConfigurationThe ASN bank from the Netherlands is the default. If you want a
different bank code and/or bank id you need to define it in the ofxstatement
configuration:$ ofxstatement edit-configThis is a sample configuration (do not forget to specify plugin for each section):[ing:nl]
plugin = mt940
bank_id = myingbankid

[mBank]
plugin = mt940
bank_code = mBank

[asnb]
plugin = mt940
bank_code = ASNB
bank_id = myasnbbankidBank codes and their bank idThese are the predefined bank codes (case insensitive) and their corresponding
bank id's (tag BANKID) in the OFX file:Bank codeBank idCommentASNASNBNL21Dutch bank with special processing instructions for MT940 tag 61, seetest_tags.pyABNAMROABNANL2ADutch bankINGINGBNL2ADutch bankKNABKNABNL2HDutch bankRABORABONL2UDutch bankSNSSNSBNL2ADutch bankTRIODOSTRIONL2UDutch bankMBANKBREXPLPWPolish bank with special post processing instructions, seetest_processors.py.Please note that this list is not exhaustive and you can process a MT940 from
any bank.  Just define a bank code from this list above or else your own bank
id in the ofxstatement configuration.From theMT940project I have copied the
special processing instructions for the banks tested there, thus ASN and
MBANK. Other banks do not seem to need special instructions to parse their
MT940 file.Other configuration optionsIn certain situations you may get this error from your bank document download:The statement end date (2020-09-02) should be greater than the largest statement line date (2020-09-03)In that case the MT940 Closing Balance(tag 62) or Finale Closing Balance (tag
62F) has a date before the latest Statement Line (tag 61) date.  You can set
the statement end date to the highest of the (Final) Closing Balance date and
latest Statement Line (tag 61) date by settingend_date_derived_from_statementsto true.The default is false, i.e. use only tag 62 or 62F.[asnb]
plugin = mt940
bank_code = ASNB
bank_id = myasnbbankid
end_date_derived_from_statements = trueAdvanced conversions (using the configuration)This will generate an OFX to standard output with "myingbankid" for OFX tag BANKID:$ ofxstatement convert -t ing:nl src/ofxstatement/plugins/tests/samples/ing.sta -And this will generate an OFX to standard output with "BREXPLPW" for OFX tag BANKID:$ ofxstatement convert -t mBank src/ofxstatement/plugins/tests/samples/mt940_mBank.txt -Finally this will use the special instructions for ASNB but use "myasnbbankid" for
OFX tag BANKID:$ ofxstatement convert -t asnb src/ofxstatement/plugins/tests/samples/mt940_ASNB.txt -Change historySee the Changelog (CHANGELOG.md).ChangelogAll notable changes to this project will be documented in this file.The format is based onKeep a Changelog,
and this project adheres toSemantic Versioning.[Unreleased][1.3.1] - 2022-01-05AddedReviewed and added test requirements[1.3.0] - 2020-09-06ChangedReplaced ignore_check_end_date configuration option by end_date_derived_from_statements[1.2.0] - 2020-09-06AddedAdded ignore_check_end_date configuration optionChangedImproved code quality by using pycodestyle and Python typing module[1.1.0] - 2020-03-26AddedAdded reference to the Changelog in the Readme.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.Added GNU Makefile for keeping the important operations together.MANIFEST.in now includes the Makefile and CHANGELOG.md.ChangedThe 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 ofhttps://github.com/kedder/ofxstatement.git.Theabout.py file outputs the version number and that is
used in the Makefile.Code refactoring.Readme enhanced.[1.0.0] - 2020-03-15AddedFirst version to convert a Swift MT940 file to an OFX file.