The goal of this project is to create a Python script that simply modifies transactions in a financial data file.
QIF is a ASCII text-based financial file format that lists account transactions sequentially.
I need to work around a limitation: when exporting from one package in this format and importing into another, the destination application applies a filtering algorithm to the imported QIF file such that 'very similar' transactions are deleted on import. This is stupid, but I can't fix its behavior.
I have run a simple test and talked to the application developer. This behavior can be avoided by modifying the Payee field for the similar transaction such that each one is appended with a unique identifier.
The attached files demonstrates a QIF file before and after this modification. There are three ATM transactions for the same date, same amount, same payee. In the payee field for these transactions, the additional text 'UNIQUE1' and 'UNIQUE2' are added to the matching transactions. This was sufficient to get around the problematic filtering.
You can identify transactions that need to be modified because the transaction amount is the same, the Payee is the same, and the date is the same. Transactions are separated by the caret ^ character. You can assume that problematic similar transactions are adjacent entries in the QIF file.
I want a python script that can run on Python 2.6.1.
The QIF input file should be an input argument.
A new QIF file should be saved with the modifications.
I may want to share this script freely for other users with the same problem. Author attribution is ok, but license or copyright terms must allow me to give this away.
Adequate code commenting is needed. I may want to make my own modification if this fix isn't totally successful.