def __init__(self, ofx, name, indent=4, ledger=None, fid=None, unknownaccount=None, payee_format=None): super(OfxConverter, self).__init__(ledger=ledger, indent=indent, unknownaccount=unknownaccount, currency=ofx.account.statement.currency, payee_format=payee_format) self.acctid = ofx.account.account_id self.payee_format = payee_format # build SecurityList (including indexing by CUSIP and ticker symbol) if hasattr(ofx, 'security_list') and ofx.security_list is not None: self.security_list = SecurityList(ofx.security_list) else: self.security_list = SecurityList([]) if fid is not None: self.fid = fid else: if ofx.account.institution is None: raise EmptyInstitutionException( "Institution provided by OFX is empty and no fid supplied!" ) else: self.fid = ofx.account.institution.fid self.name = name
def import_ofx(ledger, args): sync = OfxSynchronizer(ledger) (ofx, txns) = sync.parse_file(args.PATH) accountname = args.account if accountname is None: if ofx.account.institution is not None: accountname = "%s:%s" % (ofx.account.institution.organization, ofx.account.account_id) else: raise EmptyInstitutionException("Institution provided by OFX is \ empty and no accountname supplied!") converter = OfxConverter(account=ofx.account, name=accountname, ledger=ledger, indent=args.indent, fid=args.fid, unknownaccount=args.unknownaccount) print_results(converter, ofx, ledger, txns, args)
def __init__(self, account, name, indent=4, ledger=None, fid=None, unknownaccount=None, payee_format=None, hardcodeaccount=None, shortenaccount=False, security_list=SecurityList([]), date_format=None, infer_account=True): super(OfxConverter, self).__init__(ledger=ledger, indent=indent, unknownaccount=unknownaccount, currency=account.statement.currency, payee_format=payee_format, date_format=date_format, infer_account=infer_account) self.real_acctid = account.account_id if hardcodeaccount is not None: self.acctid = hardcodeaccount elif shortenaccount: self.acctid = account.account_id[-4:] else: self.acctid = account.account_id self.payee_format = payee_format self.security_list = security_list if fid is not None: self.fid = fid else: if account.institution is None: raise EmptyInstitutionException( "Institution provided by OFX is empty and no fid supplied!" ) else: self.fid = account.institution.fid self.name = name
def __init__(self, account, name, indent=4, ledger=None, fid=None, unknownaccount=None): super(OfxConverter, self).__init__(ledger=ledger, indent=indent, unknownaccount=unknownaccount, currency=account.statement.currency) self.acctid = account.account_id if fid is not None: self.fid = fid else: if account.institution is None: raise EmptyInstitutionException( "Institution provided by OFX is empty and no fid supplied!" ) else: self.fid = account.institution.fid self.name = name