示例#1
0
文件: utrade.py 项目: huruka/beangulp
            return False

        # Get all the links with the expected ut$ID format.
        aids = [link for link in a.links if re.match(r'ut\d{8}', link)]
        if not aids:
            # If there are no matching links, stop here.
            return False

        # Get all the links with the expected ut$ID format.
        bids = [link for link in b.links if re.match(r'ut\d{8}', link)]
        if not bids:
            # If there are no matching links, stop here.
            return False

        if len(aids) != len(bids):
            return False

        # Compare all collected IDs.
        if all(aid == bid for aid, bid in zip(sorted(aids), sorted(bids))):
            return True

        return False


if __name__ == '__main__':
    importer = Importer("USD", "Assets:US:UTrade", "Assets:US:UTrade:Cash",
                        "Income:US:UTrade:{}:Dividend",
                        "Income:US:UTrade:{}:Gains", "Expenses:Financial:Fees",
                        "Assets:US:BofA:Checking")
    main(importer)
示例#2
0
from beangulp.importers import csv
from beangulp.testing import main


class Importer(csv.Importer):
    def __init__(self, account):
        super().__init__(
            {
                csv.Col.DATE: 'Posting Date',
                csv.Col.NARRATION1: 'Description',
                csv.Col.NARRATION2: 'Check or Slip #',
                csv.Col.AMOUNT: 'Amount',
                csv.Col.BALANCE: 'Balance',
                csv.Col.DRCR: 'Details'
            },
            account,
            'USD', ('Details,Posting Date,"Description",Amount,'
                    'Type,Balance,Check or Slip #,'),
            institution='csvbank')


if __name__ == '__main__':
    main(Importer('Assets:US:CSVBank'))