class BUYDEBT(Aggregate): """OFX section 13.9.2.4.4""" invbuy = SubAggregate(INVBUY, required=True) accrdint = Decimal()
class LINEITEM(Aggregate): """ OFX Section 12.5.2.5 """ litmamt = Decimal(required=True) litmdesc = String(80, required=True)
class INVSELL(Aggregate, Origcurrency): """OFX section 13.9.2.4.3""" invtran = SubAggregate(INVTRAN, required=True) secid = SubAggregate(SECID, required=True) units = Decimal(required=True) unitprice = Decimal(required=True) markdown = Decimal() commission = Decimal() taxes = Decimal() fees = Decimal() load = Decimal() withholding = Decimal() taxexempt = Bool() total = Decimal(required=True) gain = Decimal() currency = SubAggregate(CURRENCY) origcurrency = SubAggregate(ORIGCURRENCY) subacctsec = OneOf(*INVSUBACCTS, required=True) subacctfund = OneOf(*INVSUBACCTS, required=True) loanid = String(32) statewithholding = Decimal() penalty = Decimal() inv401ksource = OneOf(*INV401KSOURCES)
class TAX1099OID_V100(Aggregate): """ OFX tax extensions section 2.2.14 """ srvrtid = String(10, required=True) taxyear = Integer(4, required=True) void = Bool() corrected = Bool() origisdisc = Decimal() otherperint = Decimal() erlwithpen = Decimal() fedtaxwh = Decimal() marketdiscount = Decimal() acqpremium = Decimal() description = String(2000) oidonustres = Decimal() investexp = Decimal() bondpremium = Decimal() taxexemptoid = Decimal() origstate = ListItem(ORIGSTATE) privactbondamt = Decimal() privactbondint = Decimal() statecode = String(2) stateidnum = String(32) statetaxwheld = Decimal() addlstatetaxwhagg = SubAggregate(ADDLSTATETAXWHAGG) payeraddr = SubAggregate(PAYERADDR) payerid = String(32, required=True) recid = String(32) recacct = String(32) tinnot = Bool() fatca = Bool() optionalMutexes = [ ["statecode", "addlstatetaxwhagg"], ["stateidnum", "addlstatetaxwhagg"], ["statetaxwheld", "addlstatetaxwhagg"], ]
class LCLTAXWHAGG(Aggregate): """ OFX tax extensions section 2.2.10 """ amount = Decimal(required=True) namelcl = String(32, required=True) lcldist = Decimal()
class REWARDINFO(Aggregate): """ OFX section 11.4.3.2 """ name = String(32, required=True) rewardbal = Decimal(required=True) rewardearned = Decimal()
class PORTION(Aggregate): """ OFX section 13.8.5.3 """ assetclass = OneOf(*ASSETCLASSES, required=True) percent = Decimal(required=True)
class TAX1099MISC_V100(Aggregate): """ OFX tax extensions section 2.2.9 """ srvrtid = String(10, required=True) taxyear = Integer(4, required=True) void = Bool() corrected = Bool() rents = Decimal() royalties = Decimal() otherincome = Decimal() federaltaxwh = Decimal() fishboatpro = Decimal() medhealthpay = Decimal() nonempcomp = Decimal() subpmts = Decimal() payer5ksales = Decimal() cropinspro = Decimal() sttaxwh = Decimal() payerstate = String(2) payerstid = String(32) stincome = Decimal() addlsttaxwhagg = ListItem(ADDLSTTAXWHAGG) grossattor = Decimal() excsgldn = Decimal() sec409adeferrals = Decimal() sec409aincome = Decimal() payeraddr = SubAggregate(PAYERADDR, required=True) payerid = String(32, required=True) recaddr = SubAggregate(RECADDR) recid = String(32) recacct = String(32) tinnot = Bool() fatca = Bool() optionalMutexes = [["sttaxwh", "addlsttaxwhagg"]] @classmethod def validate_args(cls, *args, **kwargs): if "STTAXWH" in kwargs and "PAYERSTATE" not in kwargs: msg = "{}: payerstate must also be provided if sttaxwh is provided" raise ValueError(msg) super().validate_args(*args, **kwargs)
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)
class ORIGSTATE(Aggregate): """ OFX tax extensions section 2.2.12 """ origstatecode = String(2, required=True) origstateallocamt = Decimal()
class ADDLSTATETAXWHAGG(Aggregate): """ OFX tax extensions section 2.2.12 """ statecode = String(2, required=True) stateidnum = String(32) statetaxwheld = Decimal(required=True)
class FORINCOME(Aggregate): """ OFX tax extensions section 2.2.12 """ countrystring = String(32, required=True) forincomeallocamt = Decimal()
class STKBND(Aggregate): """ OFX tax extensions section 2.2.11 """ stkbndamt = Decimal(required=True) sbgros = Bool() sbgrosless = Bool()
class FIPORTION(Aggregate): """ OFX section 13.8.5.3 """ fiassetclass = String(32, required=True) percent = Decimal(required=True)
class SELLDEBT(Aggregate): """OFX section 13.9.2.4.4""" invsell = SubAggregate(INVSELL, required=True) sellreason = OneOf("CALL", "SELL", "MATURITY", required=True) accrdint = Decimal()
class TAX1099INT_V100(Aggregate): """ OFX tax extensions section 2.2.12 """ srvrtid = String(10, required=True) taxyear = Integer(4, required=True) void = Bool() corrected = Bool() payerrtn = String(32) intincome = Decimal() intusbndtrs = Decimal() fedtaxwh = Decimal() investexp = Decimal() fortaxpd = Decimal() forincomeamt = Decimal() forcnt = String(32) forincome = ListItem(FORINCOME) taxexemptint = Decimal() origstate = ListItem(ORIGSTATE) specifiedpabint = Decimal() marketdiscount = Decimal() bondpremium = Decimal() bondpremusobligations = Decimal() tebondpremium = Decimal() cusipnum = String(32) statecode = String(2) stateidnum = String(32) statetaxwheld = Decimal() addlstatetaxwhagg = SubAggregate(ADDLSTATETAXWHAGG) payeraddr = SubAggregate(PAYERADDR, required=True) payerid = String(32, required=True) recaddr = SubAggregate(RECADDR) recid = String(32) recacct = String(32) tinnot = Bool() fatca = Bool() optionalMutexes = [ ["forcnt", "forincome"], ["statecode", "addlstatetaxwhagg"], ["stateidnum", "addlstatetaxwhagg"], ["statetaxwheld", "addlstatetaxwhagg"], ]
class AVAILBAL(Aggregate): """ OFX section 11.4.2.2 """ balamt = Decimal(required=True) dtasof = DateTime(required=True)
class TAX1099DIV_V100(Aggregate): """ OFX tax extensions section 2.2.13 """ srvrtid = String(10, required=True) taxyear = Integer(4, required=True) void = Bool() corrected = Bool() orddiv = Decimal() qualifieddiv = Decimal() totcapgain = Decimal() p28gain = Decimal() unrecsec1250 = Decimal() sec1202 = Decimal() nontaxdist = Decimal() fedtaxwh = Decimal() sec199a = Decimal() investexp = Decimal() fortaxpd = Decimal() forincomeamt = Decimal() forcnt = String(32) forincome = ListItem(FORINCOME) cashliq = Decimal() noncashliq = Decimal() exemptintdiv = Decimal() origstate = SubAggregate(ORIGSTATE) specifiedpabintdiv = Decimal() statecode = String(2) stateidnum = String(32) statetaxwheld = Decimal() addlstatetaxwhagg = SubAggregate(ADDLSTATETAXWHAGG) payeraddr = SubAggregate(PAYERADDR, required=True) payerid = String(32, required=True) recaddr = SubAggregate(RECADDR) recid = String(32, required=True) recacct = String(32) tinnot = Bool() fatca = Bool() optionalMutexes = [["forcnt", "forincome"], ["statetaxwheld", "addlstatetaxwhagg"]]
class RECPMTRQ(Aggregate): """ OFX Section 12.7.1.1 """ recurrinst = SubAggregate(RECURRINST, required=True) pmtinfo = SubAggregate(PMTINFO, required=True) initialamt = Decimal() finalamt = Decimal()
class ORIGCURRENCY(Aggregate): """ OFX section 5.2 """ currate = Decimal(required=True) cursym = OneOf(*CURRENCY_CODES, required=True)