Exemplo n.º 1
0
class CCSTMTENDRQ(Aggregate):
    """ OFX section 11.5.3 """

    ccacctfrom = SubAggregate(CCACCTFROM, required=True)
    dtstart = DateTime()
    dtend = DateTime()
    incstmtimg = Bool()
Exemplo n.º 2
0
class OTHERINFO(Aggregate):
    """ OFX Section 13.8.5.5 """

    secinfo = SubAggregate(SECINFO, required=True)
    typedesc = String(32)
    assetclass = OneOf(*ASSETCLASSES)
    fiassetclass = String(32)
Exemplo n.º 3
0
class INV401K(Aggregate):
    """ OFX section 13.9.3 """

    employername = String(32, required=True)
    planid = String(32)
    planjoindate = DateTime()
    employercontactinfo = String(255)
    brokercontactinfo = String(255)
    deferpctpretax = Decimal()
    deferpctaftertax = Decimal()
    matchinfo = SubAggregate(MATCHINFO)
    contribinfo = SubAggregate(CONTRIBINFO)
    currentvestpct = Decimal()
    vestinfo = ListItem(VESTINFO)
    loaninfo = ListItem(LOANINFO)
    inv401ksummary = SubAggregate(INV401KSUMMARY)
Exemplo n.º 4
0
class SIGNUPMSGSETV1(Aggregate):
    """ OFX section 8.8 """

    msgsetcore = SubAggregate(MSGSETCORE, required=True)
    clientenroll = SubAggregate(CLIENTENROLL)
    webenroll = SubAggregate(WEBENROLL)
    otherenroll = SubAggregate(OTHERENROLL)
    chguserinfo = Bool(required=True)
    availaccts = Bool(required=True)
    clientactreq = Bool(required=True)

    optionalMutexes = [
        ["clientenroll", "webenroll"],
        ["clientenroll", "otherenroll"],
        ["webenroll", "otherenroll"],
    ]
Exemplo n.º 5
0
class MSGSETCORE(Aggregate):
    """ OFX section 7.2.1 """

    ver = Integer(required=True)
    url = String(255, required=True)
    ofxsec = OneOf("NONE", "TYPE1", required=True)
    transpsec = Bool(required=True)
    signonrealm = String(32, required=True)
    language = OneOf(*LANG_CODES, required=True)
    syncmode = OneOf("FULL", "LITE", required=True)
    refreshsupt = Bool()
    respfileer = Bool(required=True)
    spname = String(32)
    ofxextension = SubAggregate(OFXEXTENSION)

    @staticmethod
    def groom(elem):
        """
        Remove proprietary tags e.g. INTU.XXX
        """
        # Keep input free of side effects
        elem = deepcopy(elem)

        for child in set(elem):
            if "." in child.tag:
                elem.remove(child)

        return super(MSGSETCORE, MSGSETCORE).groom(elem)
Exemplo n.º 6
0
class STOCKINFO(Aggregate):
    """ OFX Section 13.8.5.6 """
    secinfo = SubAggregate(SECINFO, required=True)
    stocktype = OneOf('COMMON', 'PREFERRED', 'CONVERTIBLE', 'OTHER')
    yld = Decimal(4)
    dtyieldasof = DateTime()
    typedesc = String(32)
    assetclass = OneOf(*ASSETCLASSES)
    fiassetclass = String(32)

    @staticmethod
    def groom(elem):
        """
        Rename all Elements tagged YIELD (reserved Python keyword) to YLD
        """
        yld = elem.find('./YIELD')
        if yld is not None:
            yld.tag = 'YLD'

        return super(STOCKINFO, STOCKINFO).groom(elem)

    @staticmethod
    def ungroom(elem):
        """
        Rename YLD back to YLD
        """
        yld = elem.find('./YLD')
        if yld is not None:
            yld.tag = 'YIELD'

        return super(STOCKINFO, STOCKINFO).ungroom(elem)
Exemplo n.º 7
0
class SECLISTTRNRQ(Aggregate):
    """ OFX section 13.8.2.1 """
    trnuid = String(36, required=True)
    cltcookie = String(32)
    tan = String(80)
    ofxextension = Unsupported()
    seclisttrq = SubAggregate(SECLISTRQ)
Exemplo n.º 8
0
class SELLMF(Aggregate):
    """ OFX section 13.9.2.4.4 """

    invsell = SubAggregate(INVSELL, required=True)
    selltype = OneOf(*SELLTYPES, required=True)
    avgcostbasis = Decimal()
    relfitid = String(255)
Exemplo n.º 9
0
class JRNLFUND(Aggregate):
    """ OFX section 13.9.2.4.4 """

    invtran = SubAggregate(INVTRAN, required=True)
    subacctto = OneOf(*INVSUBACCTS, required=True)
    subacctfrom = OneOf(*INVSUBACCTS, required=True)
    total = Decimal(required=True)
Exemplo n.º 10
0
class BANKACCTINFO(Aggregate):
    """ OFX section 8.5.3 """
    bankacctfrom = SubAggregate(BANKACCTFROM)
    svcstatus = OneOf(*SVCSTATUSES)
    suptxdl = Unsupported()
    xfersrc = Unsupported()
    xferdest = Unsupported()
Exemplo n.º 11
0
class BILLPAYMSGSETV1(Aggregate):
    """ OFX section 12.11.2 """

    msgsetcore = SubAggregate(MSGSETCORE, required=True)
    dayswith = Integer(3, required=True)
    dfltdaystopay = Integer(3, required=True)
    xferdayswith = Integer(3, required=True)
    xferdfltdaystopay = Integer(3, required=True)
    # FIXME
    # Need to define an Aggregate subclass that support multiple repeated
    # Elements (not just SubAggregates, like List) for PROCDAYSOFF.
    procdaysoff = Unsupported()
    procendtm = Time(required=True)
    modelwnd = Integer(3, required=True)
    postprocwnd = Integer(3, required=True)
    stsviamods = Bool(required=True)
    pmtbyaddr = Bool(required=True)
    pmtbyxfer = Bool(required=True)
    pmtbypayeeid = Bool(required=True)
    canaddpayee = Bool(required=True)
    hasextdpmt = Bool(required=True)
    canmodpmts = Bool(required=True)
    canmodmdls = Bool(required=True)
    difffirstpmt = Bool(required=True)
    difflastpmt = Bool(required=True)
    billpubcontext = Bool()
Exemplo n.º 12
0
class CREDITCARDMSGSETV1(Aggregate):
    """ OFX section 11.13.3 """

    msgsetcore = SubAggregate(MSGSETCORE, required=True)
    closingavail = Bool(required=True)
    pendingavail = Bool()
    imageprof = Unsupported()
Exemplo n.º 13
0
class PMTINFO(Aggregate):
    """ OFX Section 12.5.2 """
    bankacctfrom = SubAggregate(BANKACCTFROM, required=True)
    trnamt = Decimal(required=True)
    payeeid = String(12)
    payee = SubAggregate(PAYEE)
    payeelstid = String(12)
    bankacctto = SubAggregate(BANKACCTTO)
    extdpmt = ListItem(EXTDPMT)
    payacct = String(32, required=True)
    dtdue = DateTime(required=True)
    memo = String(255)
    billrefinfo = String(80)
    billpubinfo = SubAggregate(BILLPUBINFO)

    requiredMutexes = [("payeeid", "payee")]
Exemplo n.º 14
0
class TAX1099MSGSETV1(Aggregate):
    """ OFX tax extensions section 2.1 """

    msgsetcore = SubAggregate(MSGSETCORE, required=True)
    tax1099dnld = Bool(required=True)
    extd1099b = Bool(required=True)
    taxyearsupported = Integer(required=True)
Exemplo n.º 15
0
class TAX1099R_V100(Aggregate):
    """ OFX tax extensions section 2.2.10 """

    srvrtid = String(10, required=True)
    taxyear = Integer(4, required=True)
    void = Bool()
    grossdist = Bool()
    taxamt = Decimal()
    taxamtnd = Decimal()
    totaldist = Bool()
    capgain = Decimal()
    fedtaxwh = Decimal()
    empcontins = Decimal()
    netunapmp = Decimal()
    nonempcomp = Decimal()
    distcode = String(1, required=True)
    irasepsimp = Bool()
    annctrctdist = Decimal()
    annctrctper = Decimal()
    pertodist = Decimal()
    totempcont = Decimal()
    amtallocableirr = Decimal()
    firstyeardesigroth = Integer(4)
    sttaxwhagg = ListItem(STTAXWHAGG)
    lcltaxwhagg = ListItem(LCLTAXWHAGG)
    payeraddr = SubAggregate(PAYERADDR, required=True)
    payerid = String(32, required=True)
    recaddr = SubAggregate(RECADDR)
    recid = String(32)
    recacct = String(32)
    fatca = Bool()
    dtbenefitpmt = DateTime()

    @classmethod
    def validate_args(cls, *args, **kwargs):
        # "[IRASEPSIMP] is required if any of the following tags are present in
        # the 1099R aggregate: GROSSDIST, TAXAMT, FEDTAXWH, STTAXWH,
        # or LCLTAXWH"
        has_irasepsimp = "irasepsimp" in kwargs
        for tag in ("grossdist", "taxamt", "fedtaxwh", "sttaxwh", "lcltaxwh"):
            if tag in kwargs and not has_irasepsimp:
                msg = (
                    "{}.__init__(): irasepsimp must also be provided if {} is provided"
                )
                raise ValueError(msg.format(cls.__name__, tag))

        super().validate_args(*args, **kwargs)
Exemplo n.º 16
0
class REINVEST(Aggregate, Origcurrency):
    """ OFX section 13.9.2.4.4 """
    invtran = SubAggregate(INVTRAN, required=True)
    secid = SubAggregate(SECID, required=True)
    incometype = OneOf(*INCOMETYPES, required=True)
    total = Decimal(required=True)
    subacctsec = OneOf(*INVSUBACCTS, required=True)
    units = Decimal(required=True)
    unitprice = Decimal(4, required=True)
    commission = Decimal()
    taxes = Decimal()
    fees = Decimal()
    load = Decimal()
    taxexempt = Bool()
    currency = SubAggregate(CURRENCY)
    origcurrency = SubAggregate(ORIGCURRENCY)
    inv401ksource = OneOf(*INV401KSOURCES)
Exemplo n.º 17
0
class OO(Aggregate):
    """ OFX section 13.9.2.5.1 - General open order aggregate """

    fitid = String(255, required=True)
    srvrtid = String(10)
    secid = SubAggregate(SECID, required=True)
    dtplaced = DateTime(required=True)
    units = Decimal(required=True)
    subacct = OneOf(*INVSUBACCTS, required=True)
    duration = OneOf("DAY", "GOODTILCANCEL", "IMMEDIATE", required=True)
    restriction = OneOf("ALLORNONE", "MINUNITS", "NONE", required=True)
    minunits = Decimal()
    limitprice = Decimal()
    stopprice = Decimal()
    memo = String(255)
    currency = SubAggregate(CURRENCY)
    inv401ksource = OneOf(*INV401KSOURCES)
Exemplo n.º 18
0
class WIRERS(Aggregate):
    """ OFX section 11.9.1.2 """

    curdef = OneOf(*CURRENCY_CODES, required=True)
    srvrtid = String(10, required=True)
    bankacctfrom = SubAggregate(BANKACCTFROM, required=True)
    wirebeneficiary = SubAggregate(WIREBENEFICIARY, required=True)
    wiredestbank = SubAggregate(WIREDESTBANK)
    trnamt = Decimal(required=True)
    dtdue = DateTime()
    payinstruct = String(255)
    dtxferprj = DateTime()
    dtposted = DateTime()
    fee = Decimal()
    confmsg = String(255)

    optionalMutexes = [("dtxferprj", "dtposted")]
Exemplo n.º 19
0
class PROFTRNRS(TrnRs):
    """ OFX section 7.2 """

    profrs = SubAggregate(PROFRS)

    @property
    def profile(self):
        return self.profrs
Exemplo n.º 20
0
class BAL(Aggregate):
    """ OFX section 3.1.4 """
    name = String(32, required=True)
    desc = String(80, required=True)
    baltype = OneOf('DOLLAR', 'PERCENT', 'NUMBER', required=True)
    value = Decimal(required=True)
    dtasof = DateTime()
    currency = SubAggregate(CURRENCY)
Exemplo n.º 21
0
class POSMF(Aggregate):
    """ OFX section 13.9.2.6.1 """

    invpos = SubAggregate(INVPOS, required=True)
    unitsstreet = Decimal()
    unitsuser = Decimal()
    reinvdiv = Bool()
    reinvcg = Bool()
Exemplo n.º 22
0
class STPCHKRS(Aggregate):
    """ OFX section 11.6.1.1 """

    curdef = OneOf(*CURRENCY_CODES, required=True)
    bankacctfrom = SubAggregate(BANKACCTFROM, required=True)
    stpchknum = ListItem(STPCHKNUM)
    fee = Decimal(required=True)
    feemsg = String(80, required=True)
Exemplo n.º 23
0
class SELLOPT(Aggregate):
    """ OFX section 13.9.2.4.4 """
    invsell = SubAggregate(INVSELL, required=True)
    optselltype = OneOf(*OPTSELLTYPES, required=True)
    shperctrct = Integer(required=True)
    relfitid = String(255)
    reltype = OneOf('SPREAD', 'STRADDLE', 'NONE', 'OTHER')
    secured = OneOf('NAKED', 'COVERED')
Exemplo n.º 24
0
class INVSTMTTRNRS(TrnRs):
    """ OFX section 13.9.2.1 """

    invstmtrs = SubAggregate(INVSTMTRS)

    @property
    def statement(self):
        return self.invstmtrs
Exemplo n.º 25
0
class SECRQ(Aggregate):
    """ OFX section 13.8.2.2 """

    secid = SubAggregate(SECID)
    ticker = String(32)
    fiid = String(32)

    requiredMutexes = [("secid", "ticker", "fiid")]
Exemplo n.º 26
0
class INVSTMTRS(Aggregate):
    """ OFX section 13.9.2.1 """

    dtasof = DateTime(required=True)
    curdef = OneOf(*CURRENCY_CODES, required=True)
    invacctfrom = SubAggregate(INVACCTFROM, required=True)
    invtranlist = SubAggregate(INVTRANLIST)
    invposlist = SubAggregate(INVPOSLIST)
    invbal = SubAggregate(INVBAL)
    invoolist = SubAggregate(INVOOLIST)
    mktginfo = String(360)
    inv401kbal = SubAggregate(INV401KBAL)
    inv401k = SubAggregate(INV401K)

    @property
    def account(self):
        return self.invacctfrom

    @property
    def transactions(self):
        return self.invtranlist

    @property
    def positions(self):
        return self.invposlist

    @property
    def balances(self):
        return self.invbal