Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MT940 format parser

Can you recommend any OS, ready-to-go, well-documented and not dead MT940 format parser for Python?

like image 774
bx2 Avatar asked Sep 30 '10 13:09

bx2


People also ask

What is the MT940 format?

The MT940 is a standard SWIFT (Society for Worldwide Interbank Financial Telecommunication) message for electronic banking statements. Many software packages are able to process information stated in this international standard format. It is often called the electronic banking statement.

What is MT940 service?

The Customer Statement - SWIFT MT940 service is aimed at large companies or groups of companies that want to check the balances and transactions of accounts they or their subsidiaries hold with Piraeus Bank (if they are members of SCORE) to have a third party they cooperate with do so.


2 Answers

Possibly a little late to the party, but I've written a library to support MT940 with Python some time ago. I've just given it a large update to be a bit more versatile so it should do the trick for most people: https://github.com/WoLpH/mt940

If there are any problems, please let me know. Pull requests are always welcome :)

Currently it supports reading any Mt940 file I could find (I have a testset of 31 files) and depending on the format it will parse more or less information.

To add specific support for your files there is pre- and post-processor support to add some custom parsing: http://mt940.readthedocs.org/en/latest/mt940.html#mt940.models.Transactions Some banks have extra information in the transaction details which is easily supportable using this method.

Documentation can be found on readthedocs: http://mt940.readthedocs.org/en/latest/mt940.html

The package is installable through Pypi: https://pypi.python.org/pypi/mt-940

pip install mt-940

Example usage:

import mt940
import pprint

transactions = mt940.parse('tests/jejik/abnamro.sta')

print 'Transactions:'
print transactions
pprint.pprint(transactions.data)

print
for transaction in transactions:
    print 'Transaction: ', transaction
    pprint.pprint(transaction.data)
like image 168
Wolph Avatar answered Nov 15 '22 04:11

Wolph


I only manage to find this python project: https://github.com/headcr4sh/django-banking Maybe you can extend/update the above project for your own purpose. The code is quite easy to read.

If you don't mind using Java, there's one up to date project that could parse/create any swift message easily:

http://sourceforge.net/projects/wife/

Code sample:

creation: https://github.com/prowide/prowide-core-examples/blob/master/src/com/prowidesoftware/swift/samples/MessageCreationExample.java

parsing: https://github.com/prowide/prowide-core-examples/blob/master/src/com/prowidesoftware/swift/samples/ParseMT940Example.java

their website: http://www.prowidesoftware.com/core.jsp

like image 44
Yudhistira Arya Avatar answered Nov 15 '22 02:11

Yudhistira Arya