ofxparse icon indicating copy to clipboard operation
ofxparse copied to clipboard

Currency on transactions

Open mralbu opened this issue 8 years ago • 2 comments

I needed to parse CURRENCY tags as well (#100), so I've modified the transaction parser to retrieve transaction currencies other than CURDEF. mralbu@591b6fe I've added an ofx file to fixtures and a test function for it as well. Do you think this solution is acceptable? Would you accept it as a pull request?

mralbu avatar Feb 02 '17 02:02 mralbu

I had the same problem and fix it. I tried to make a PR but git says that i had no permission to to read from remote repository

ERROR: Permission to jseutter/ofxparse.git denied to heitorpolidoro.
fatal: Could not read from remote repository.

This is my change on ofxparse/ofxparse.py:


class Transaction(object):
    def __init__(self):
        self.payee = ''
        self.type = ''
        self.date = None
        self.amount = None
        self.id = ''
        self.memo = ''
        self.sic = None
        self.mcc = ''
        self.checknum = ''
        self.currate = 1  # New attribute. Default is 1 so I can always use currate * amount


And in parseTransaction() add:

        currate_tag = txn_ofx.find('currate')
        if hasattr(currate_tag, "contents"):
            try:
                transaction.currate = cls.toDecimal(currate_tag)
            except IndexError:
                # Memo can be empty.
                pass
            except TypeError:
                pass

heitorpolidoro avatar Dec 04 '19 16:12 heitorpolidoro

Thanks for your support @heitorpolidoro.

heliocarbex avatar Jan 30 '22 17:01 heliocarbex