ofxparse
ofxparse copied to clipboard
Currency on transactions
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?
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
Thanks for your support @heitorpolidoro.