How to use ofxtools - 10 common examples

To help you get started, we’ve selected a few ofxtools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wesabe / fixofx / test / ofxtools_qif_converter.py View on Github external
def test_uk_date(self):
        qiftext = textwrap.dedent('''\
        !Type:Bank
        D13/01/2005
        ^
        ''')
        converter = ofxtools.QifConverter(qiftext)
        self.assertTrue(converter.txns_by_date.has_key("20050113"))
github wesabe / fixofx / test / ofxtools_qif_converter.py View on Github external
def test_amount2(self):
        qiftext = textwrap.dedent('''\
        !Type:Bank
        D02/01/2005
        U25.42
        ^
        ''')
        converter = ofxtools.QifConverter(qiftext)
        txn = converter.txns_by_date["20050201"][0]
        self.assertEqual(txn["Amount"], "25.42")
github wesabe / fixofx / test / ofxtools_qif_converter.py View on Github external
def test_slashfree_date(self):
        qiftext = textwrap.dedent('''\
        !Type:Bank
        D12012005
        ^
        ''')
        converter = ofxtools.QifConverter(qiftext)
        self.assertTrue(converter.txns_by_date.has_key("20051201"))
github wesabe / fixofx / test / ofxtools_qif_converter.py View on Github external
def test_found_currency(self):
        qiftext = textwrap.dedent('''\
        !Type:Bank
        D01/25/2007
        T417.93
        ^EUR
        ''')
        converter = ofxtools.QifConverter(qiftext)
        ofx102 = converter.to_ofx102()
        self.assertTrue(ofx102.find('EUR') != -1)
github wesabe / fixofx / test / ofxtools_qif_converter.py View on Github external
def test_bad_amount_precision(self):
        qiftext = textwrap.dedent('''\
        !Type:Bank
        D01/25/2007
        T417.930
        ^
        ''')
        converter = ofxtools.QifConverter(qiftext)
        txn = converter.txns_by_date["20070125"][0]
        self.assertEqual(txn["Amount"], "417.93")
github wesabe / fixofx / test / ofxtools_qif_converter.py View on Github external
def test_dash_amount(self):
        qiftext = textwrap.dedent('''\
        !Type:Bank
        D02/01/2005
        T25.42
        ^
        D02/01/2005
        T-
        ^
        ''')
        converter = ofxtools.QifConverter(qiftext)
        txn_list = converter.txns_by_date["20050201"]
        self.assertEqual(len(txn_list), 1)
        txn = txn_list[0]
        self.assertEqual(txn["Amount"], "25.42")
github wesabe / fixofx / test / ofxtools_qif_converter.py View on Github external
def test_mixed_uk_dates(self):
        qiftext = textwrap.dedent('''\
        !Type:Bank
        D12/01/2005
        ^
        D13/01/2005
        ^
        ''')
        converter = ofxtools.QifConverter(qiftext)
        self.assertTrue(converter.txns_by_date.has_key("20050112"))
        self.assertTrue(converter.txns_by_date.has_key("20050113"))
github wesabe / fixofx / test / ofxtools_qif_converter.py View on Github external
def test_check_stmt_number(self):
        qiftext = textwrap.dedent('''\
        !Type:Bank
        D01/25/2007
        T417.93
        N1234
        ^
        ''')
        converter = ofxtools.QifConverter(qiftext)
        txn = converter.txns_by_date["20070125"][0]
        self.assertEqual(txn.get("Type"), "CHECK")
github wesabe / fixofx / test / ofxtools_qif_converter.py View on Github external
def test_us_date(self):
        qiftext = textwrap.dedent('''\
        !Type:Bank
        D01/13/2005
        ^
        ''')
        converter = ofxtools.QifConverter(qiftext)
        self.assertTrue(converter.txns_by_date.has_key("20050113"))
github wesabe / fixofx / fixofx.py View on Github external
if verbose: sys.stderr.write("Beginning OFC conversion...\n")
        converter = ofxtools.OfcConverter(text, fid=fid, org=org, curdef=curdef,
                                          lang=lang, debug=debug)
        
        # This will throw a ParseException if it is unable to recognize
        # the source format.
        if verbose: 
            sys.stderr.write("Converting to OFX/1.02...\n\n%s\n\n" %
                             converter.to_ofx102())
            sys.stderr.write("Converting to OFX/2.0...\n")
                                             
        return converter.to_xml()
    
    elif filetype == "QIF":
        if verbose: sys.stderr.write("Beginning QIF conversion...\n")
        converter = ofxtools.QifConverter(text, fid=fid, org=org,
                                          bankid=bankid, accttype=accttype, 
                                          acctid=acctid, balance=balance, 
                                          curdef=curdef, lang=lang, dayfirst=dayfirst,
                                          debug=debug)
        
        # This will throw a ParseException if it is unable to recognize
        # the source format.
        if verbose: 
            sys.stderr.write("Converting to OFX/1.02...\n\n%s\n\n" %
                             converter.to_ofx102())
            sys.stderr.write("Converting to OFX/2.0...\n")
                                             
        return converter.to_xml()
    
    else:
        raise TypeError("Unable to convert source format '%s'." % filetype)

ofxtools

Library for working with Open Financial Exchange (OFX) data

GPL-3.0
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Similar packages