1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2024-11-21 19:20:05 -05:00

Use named constants instead of strings for enum-like OFX fields

This adds a python script to generate constants.go when `go generate` is
called, and updates the structs, tests, and command-line client to all
use the new named constants.
This commit is contained in:
Aaron Lindsay 2017-04-06 05:58:22 -04:00
parent ea700b33a9
commit 4521bb377a
16 changed files with 3030 additions and 382 deletions

68
bank.go
View File

@ -45,43 +45,43 @@ type Payee struct {
}
type ImageData struct {
XMLName xml.Name `xml:"IMAGEDATA"`
ImageType String `xml:"IMAGETYPE"` // One of STATEMENT, TRANSACTION, TAX
ImageRef String `xml:"IMAGEREF"` // URL or identifier, depending on IMAGEREFTYPE
ImageRefType String `xml:"IMAGEREFTYPE"` // One of OPAQUE, URL, FORMURL (see spec for more details on how to access images of each of these types)
XMLName xml.Name `xml:"IMAGEDATA"`
ImageType imageType `xml:"IMAGETYPE"` // One of STATEMENT, TRANSACTION, TAX
ImageRef String `xml:"IMAGEREF"` // URL or identifier, depending on IMAGEREFTYPE
ImageRefType imageRefType `xml:"IMAGEREFTYPE"` // One of OPAQUE, URL, FORMURL (see spec for more details on how to access images of each of these types)
// Only one of the next two should be valid at any given time
ImageDelay Int `xml:"IMAGEDELAY,omitempty"` // Number of calendar days from DTSERVER (for statement images) or DTPOSTED (for transaction image) the image will become available
DtImageAvail *Date `xml:"DTIMAGEAVAIL,omitempty"` // Date image will become available
ImageTTL Int `xml:"IMAGETTL,omitempty"` // Number of days after image becomes available that it will remain available
CheckSup String `xml:"CHECKSUP,omitempty"` // What is contained in check images. One of FRONTONLY, BACKONLY, FRONTANDBACK
ImageDelay Int `xml:"IMAGEDELAY,omitempty"` // Number of calendar days from DTSERVER (for statement images) or DTPOSTED (for transaction image) the image will become available
DtImageAvail *Date `xml:"DTIMAGEAVAIL,omitempty"` // Date image will become available
ImageTTL Int `xml:"IMAGETTL,omitempty"` // Number of days after image becomes available that it will remain available
CheckSup checkSup `xml:"CHECKSUP,omitempty"` // What is contained in check images. One of FRONTONLY, BACKONLY, FRONTANDBACK
}
type Transaction struct {
XMLName xml.Name `xml:"STMTTRN"`
TrnType String `xml:"TRNTYPE"` // One of CREDIT, DEBIT, INT (interest earned or paid. Note: Depends on signage of amount), DIV, FEE, SRVCHG (service charge), DEP (deposit), ATM (Note: Depends on signage of amount), POS (Note: Depends on signage of amount), XFER, CHECK, PAYMENT, CASH, DIRECTDEP, DIRECTDEBIT, REPEATPMT, OTHER
DtPosted Date `xml:"DTPOSTED"`
DtUser *Date `xml:"DTUSER,omitempty"`
DtAvail *Date `xml:"DTAVAIL,omitempty"`
TrnAmt Amount `xml:"TRNAMT"`
FiTId String `xml:"FITID"`
CorrectFiTId String `xml:"CORRECTFITID,omitempty"` // Transaction Id that this transaction corrects, if present
CorrectAction String `xml:"CORRECTACTION,omitempty"` // One of DELETE, REPLACE
SrvrTId String `xml:"SRVRTID,omitempty"`
CheckNum String `xml:"CHECKNUM,omitempty"`
RefNum String `xml:"REFNUM,omitempty"`
SIC Int `xml:"SIC,omitempty"` // Standard Industrial Code
PayeeId String `xml:"PAYEEID,omitempty"`
XMLName xml.Name `xml:"STMTTRN"`
TrnType trnType `xml:"TRNTYPE"` // One of CREDIT, DEBIT, INT (interest earned or paid. Note: Depends on signage of amount), DIV, FEE, SRVCHG (service charge), DEP (deposit), ATM (Note: Depends on signage of amount), POS (Note: Depends on signage of amount), XFER, CHECK, PAYMENT, CASH, DIRECTDEP, DIRECTDEBIT, REPEATPMT, OTHER
DtPosted Date `xml:"DTPOSTED"`
DtUser *Date `xml:"DTUSER,omitempty"`
DtAvail *Date `xml:"DTAVAIL,omitempty"`
TrnAmt Amount `xml:"TRNAMT"`
FiTId String `xml:"FITID"`
CorrectFiTId String `xml:"CORRECTFITID,omitempty"` // Transaction Id that this transaction corrects, if present
CorrectAction correctAction `xml:"CORRECTACTION,omitempty"` // One of DELETE, REPLACE
SrvrTId String `xml:"SRVRTID,omitempty"`
CheckNum String `xml:"CHECKNUM,omitempty"`
RefNum String `xml:"REFNUM,omitempty"`
SIC Int `xml:"SIC,omitempty"` // Standard Industrial Code
PayeeId String `xml:"PAYEEID,omitempty"`
// Note: Servers should provide NAME or PAYEE, but not both
Name String `xml:"NAME,omitempty"`
Payee *Payee `xml:"PAYEE,omitempty"`
ExtdName String `xml:"EXTDNAME,omitempty"` // Extended name of payee or transaction description
BankAcctTo *BankAcct `xml:"BANKACCTTO,omitempty"` // If the transfer was to a bank account we have the account information for
CCAcctTo *CCAcct `xml:"CCACCTTO,omitempty"` // If the transfer was to a credit card account we have the account information for
Memo String `xml:"MEMO,omitempty"` // Extra information (not in NAME)
ImageData []ImageData `xml:"IMAGEDATA,omitempty"`
Currency String `xml:"CURRENCY,omitempty"` // If different from CURDEF in STMTTRS
OrigCurrency String `xml:"ORIGCURRENCY,omitempty"` // If different from CURDEF in STMTTRS
Inv401kSource String `xml:"INV401KSOURCE,omitempty"` // One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST (Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST.)
Name String `xml:"NAME,omitempty"`
Payee *Payee `xml:"PAYEE,omitempty"`
ExtdName String `xml:"EXTDNAME,omitempty"` // Extended name of payee or transaction description
BankAcctTo *BankAcct `xml:"BANKACCTTO,omitempty"` // If the transfer was to a bank account we have the account information for
CCAcctTo *CCAcct `xml:"CCACCTTO,omitempty"` // If the transfer was to a credit card account we have the account information for
Memo String `xml:"MEMO,omitempty"` // Extra information (not in NAME)
ImageData []ImageData `xml:"IMAGEDATA,omitempty"`
Currency String `xml:"CURRENCY,omitempty"` // If different from CURDEF in STMTTRS
OrigCurrency String `xml:"ORIGCURRENCY,omitempty"` // If different from CURDEF in STMTTRS
Inv401kSource inv401kSource `xml:"INV401KSOURCE,omitempty"` // One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST (Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST.)
}
type TransactionList struct {
@ -93,7 +93,7 @@ type TransactionList struct {
type PendingTransaction struct {
XMLName xml.Name `xml:"STMTTRN"`
TrnType String `xml:"TRNTYPE"` // One of CREDIT, DEBIT, INT (interest earned or paid. Note: Depends on signage of amount), DIV, FEE, SRVCHG (service charge), DEP (deposit), ATM (Note: Depends on signage of amount), POS (Note: Depends on signage of amount), XFER, CHECK, PAYMENT, CASH, DIRECTDEP, DIRECTDEBIT, REPEATPMT, HOLD, OTHER
TrnType trnType `xml:"TRNTYPE"` // One of CREDIT, DEBIT, INT (interest earned or paid. Note: Depends on signage of amount), DIV, FEE, SRVCHG (service charge), DEP (deposit), ATM (Note: Depends on signage of amount), POS (Note: Depends on signage of amount), XFER, CHECK, PAYMENT, CASH, DIRECTDEP, DIRECTDEBIT, REPEATPMT, HOLD, OTHER
DtTran Date `xml:"DTTRAN"`
DtExpire *Date `xml:"DTEXPIRE,omitempty"` // only valid for TrnType==HOLD, the date the hold will expire
TrnAmt Amount `xml:"TRNAMT"`
@ -122,7 +122,7 @@ type Balance struct {
// DOLLAR = dollar (value formatted DDDD.cc)
// PERCENT = percentage (value formatted XXXX.YYYY)
// NUMBER = number (value formatted as is)
BalType String `xml:"BALTYPE"`
BalType balType `xml:"BALTYPE"`
Value Amount `xml:"VALUE"`
DtAsOf *Date `xml:"DTASOF,omitempty"`

View File

@ -59,7 +59,7 @@ func TestMarshalBankStatementRequest(t *testing.T) {
BankAcctFrom: ofxgo.BankAcct{
BankId: "318398732",
AcctId: "78346129",
AcctType: "CHECKING",
AcctType: ofxgo.AcctTypeChecking,
},
Include: true,
}
@ -158,14 +158,14 @@ func TestUnmarshalBankStatementResponse(t *testing.T) {
DtEnd: *ofxgo.NewDateGMT(2006, 1, 15, 0, 0, 0, 0),
Transactions: []ofxgo.Transaction{
{
TrnType: "CHECK",
TrnType: ofxgo.TrnTypeCheck,
DtPosted: *ofxgo.NewDateGMT(2006, 1, 4, 0, 0, 0, 0),
TrnAmt: trnamt1,
FiTId: "00592",
CheckNum: "2002",
},
{
TrnType: "ATM",
TrnType: ofxgo.TrnTypeATM,
DtPosted: *ofxgo.NewDateGMT(2006, 1, 12, 0, 0, 0, 0),
DtUser: ofxgo.NewDateGMT(2006, 1, 12, 0, 0, 0, 0),
TrnAmt: trnamt2,
@ -188,7 +188,7 @@ func TestUnmarshalBankStatementResponse(t *testing.T) {
BankAcctFrom: ofxgo.BankAcct{
BankId: "318398732",
AcctId: "78346129",
AcctType: "CHECKING",
AcctType: ofxgo.AcctTypeChecking,
},
BankTranList: &banktranlist,
BalAmt: balamt,

View File

@ -40,6 +40,12 @@ func downloadCheckFlags() bool {
func download() {
client, query := NewRequest()
acctTypeEnum, err := ofxgo.NewAcctType(acctType)
if err != nil {
fmt.Println("Error parsing accttype:", err)
os.Exit(1)
}
uid, err := ofxgo.RandomUID()
if err != nil {
fmt.Println("Error creating uid for transaction:", err)
@ -51,10 +57,11 @@ func download() {
BankAcctFrom: ofxgo.BankAcct{
BankId: ofxgo.String(bankId),
AcctId: ofxgo.String(acctId),
AcctType: ofxgo.String(acctType),
AcctType: acctTypeEnum,
},
Include: true,
}
query.Bank = append(query.Bank, &statementRequest)
response, err := client.RequestNoParse(query)

View File

@ -25,6 +25,12 @@ func init() {
func bankTransactions() {
client, query := NewRequest()
acctTypeEnum, err := ofxgo.NewAcctType(acctType)
if err != nil {
fmt.Println("Error parsing accttype:", err)
os.Exit(1)
}
uid, err := ofxgo.RandomUID()
if err != nil {
fmt.Println("Error creating uid for transaction:", err)
@ -36,10 +42,11 @@ func bankTransactions() {
BankAcctFrom: ofxgo.BankAcct{
BankId: ofxgo.String(bankId),
AcctId: ofxgo.String(acctId),
AcctType: ofxgo.String(acctType),
AcctType: acctTypeEnum,
},
Include: true,
}
query.Bank = append(query.Bank, &statementRequest)
response, err := client.Request(query)

View File

@ -1,5 +1,7 @@
package ofxgo
//go:generate ./generate_constants.py
import (
"errors"
"github.com/aclindsa/go/src/encoding/xml"
@ -261,7 +263,7 @@ type BankAcct struct {
BankId String `xml:"BANKID"`
BranchId String `xml:"BRANCHID,omitempty"` // Unused in USA
AcctId String `xml:"ACCTID"`
AcctType String `xml:"ACCTTYPE"` // One of CHECKING, SAVINGS, MONEYMRKT, CREDITLINE, CD
AcctType acctType `xml:"ACCTTYPE"` // One of CHECKING, SAVINGS, MONEYMRKT, CREDITLINE, CD
AcctKey String `xml:"ACCTKEY,omitempty"` // Unused in USA
}

2473
constants.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -105,21 +105,21 @@ NEWFILEUID:NONE
DtEnd: *ofxgo.NewDate(2017, 3, 31, 15, 46, 48, 688000000, EDT),
Transactions: []ofxgo.Transaction{
{
TrnType: "DEBIT",
TrnType: ofxgo.TrnTypeDebit,
DtPosted: *ofxgo.NewDateGMT(2017, 2, 9, 12, 0, 0, 0),
TrnAmt: trnamt1,
FiTId: "2017020924435657040207171600195",
Name: "SLICE OF NY",
},
{
TrnType: "CREDIT",
TrnType: ofxgo.TrnTypeCredit,
DtPosted: *ofxgo.NewDateGMT(2016, 12, 28, 12, 0, 0, 0),
TrnAmt: trnamt2,
FiTId: "2016122823633637200000258482730",
Name: "Payment Thank You Electro",
},
{
TrnType: "DEBIT",
TrnType: ofxgo.TrnTypeDebit,
DtPosted: *ofxgo.NewDateGMT(2017, 3, 27, 12, 0, 0, 0),
TrnAmt: trnamt3,
FiTId: "2017032724445727085300442885680",

155
generate_constants.py Executable file
View File

@ -0,0 +1,155 @@
#!/usr/bin/env python
enums = {
# Bank/general
"AcctType": ["Checking", "Savings", "MoneyMrkt", "CreditLine", "CD"],
"TrnType": ["Credit", "Debit", "Int", "Div", "Fee", "SrvChg", "Dep", "ATM", "POS", "Xfer", "Check", "Payment", "Cash", "DirectDep", "DirectDebit", "RepeatPmt", "Hold", "Other"],
"ImageType": ["Statement", "Transaction", "Tax"],
"ImageRefType": ["Opaque", "URL", "FormURL"],
"CheckSup": ["FrontOnly", "BackOnly", "FrontAndBack"],
"CorrectAction": ["Delete", "Replace"],
"BalType": ["Dollar", "Percent", "Number"],
# InvStmt
"Inv401kSource": ["PreTax", "AfterTax", "Match", "ProfitSharing", "Rollover", "OtherVest", "OtherNonVest"],
"SubAcctType": ["Cash", "Margin", "Short", "Other"], # used in fields named: SubAcctSec, HeldInAcct, SubAcctFund
"BuyType": ["Buy", "BuyToCover"],
"OptAction": ["Exercise", "Assign", "Expire"],
"TferAction": ["In", "Out"],
"PosType": ["Long", "Short"],
"Secured": ["Naked", "Covered"],
"Duration": ["Day", "GoodTilCancel", "Immediate"],
"Restriction": ["AllOrNone", "MinUnits", "None"],
"UnitType": ["Shares", "Currency"],
"OptBuyType": ["BuyToOpen", "BuyToClose"],
"SellType": ["Sell", "SellShort"],
"LoanPmtFreq": ["Weekly", "Biweekly", "TwiceMonthly", "Monthly", "FourWeeks", "BiMonthly", "Quarterly", "Semiannually", "Annually", "Other"],
"IncomeType": ["CGLong", "CGShort", "Div", "Interest", "Misc"],
"SellReason": ["Call", "Sell", "Maturity"],
"OptSellType": ["SellToClose", "SellToOpen"],
"RelType": ["Spread", "Straddle", "None", "Other"],
# Prof
"CharType": ["AlphaOnly", "NumericOnly", "AlphaOrNumeric", "AlphaAndNumeric"],
"SyncMode": ["Full", "Lite"],
# SecList
"DebtType": ["Coupon", "Zero"],
"DebtClass": ["Treasury", "Municipal", "Corporate", "Other"],
"CouponFreq": ["Monthly", "Quarterly", "Semiannual", "Annual", "Other"],
"CallType": ["Call", "Put", "Prefund", "Maturity"],
"AssetClass": ["DomesticBond", "IntlBond", "LargeStock", "SmallStock", "IntlStock", "MoneyMrkt", "Other"],
"MfType": ["Open", "End", "CloseEnd", "Other"],
"OptType": ["Put", "Call"],
"StockType": ["Common", "Preferred", "Convertible", "Other"],
"OfxSec": ["None", "Type 1"],
# Signup
"HolderType": ["Individual", "Joint", "Custodial", "Trust", "Other"],
"AcctClassification": ["Personal", "Business", "Corporate", "Other"],
"SvcStatus": ["Avail", "Pend", "Active"],
"UsProductType": ["401K", "403B", "IRA", "KEOGH", "Other", "SARSEP", "Simple", "Normal", "TDA", "Trust", "UGMA"],
}
header = """package ofxgo
/*
* Do not edit this file by hand. It is auto-generated by calling `go generate`.
* To make changes, edit generate_constants.py, re-run `go generate`, and check
* in the result.
*/
import (
"errors"
"fmt"
"github.com/aclindsa/go/src/encoding/xml"
"strings"
)
"""
template = """
type {enumLower} uint
const (
{constNames})
var {enumLower}s = [...]string{{"{upperValueString}"}}
func (e {enumLower}) Valid() bool {{
return e >= {firstValue} && e <= {lastValue}
}}
func (e {enumLower}) String() string {{
if e.Valid() {{
return {enumLower}s[e-1]
}}
return fmt.Sprintf("invalid {enumLower} (%d)", e)
}}
func (e *{enumLower}) FromString(in string) error {{
value := strings.TrimSpace(in)
for i, s := range {enumLower}s {{
if s == value {{
*e = {enumLower}(i + 1)
return nil
}}
}}
return errors.New("Invalid {enum}: \\\"" + in + "\\\"")
}}
func (e *{enumLower}) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {{
var value string
err := d.DecodeElement(&value, &start)
if err != nil {{
return err
}}
return e.FromString(value)
}}
func (e *{enumLower}) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {{
if *e == 0 {{
return nil
}} else if !e.Valid() {{
return errors.New("Invalid {enum}")
}}
enc.EncodeElement({enumLower}s[*e-1], start)
return nil
}}
func New{enum}(s string) ({enumLower}, error) {{
var e {enumLower}
err := e.FromString(s)
if err != nil {{
return 0, err
}}
return e, nil
}}
"""
with open("constants.go", 'w') as f:
f.write(header)
for enum in enums:
enumLower = enum[:1].lower() + enum[1:].replace(" ", "")
firstValue = enum+enums[enum][0].replace(" ", "")
lastValue = enum+enums[enum][-1].replace(" ", "")
constNames = "\t{firstValue} {enumLower} = 1 + iota\n".format(
enum=enum,
firstValue=firstValue,
enumLower=enumLower)
for value in enums[enum][1:]:
constNames += "\t{enum}{value}\n".format(
enum=enum,
value=value.replace(" ", ""))
upperValueString = "\", \"".join([s.upper() for s in enums[enum]])
f.write(template.format(enum=enum,
enumLower=enumLower,
firstValue=firstValue,
lastValue=lastValue,
constNames=constNames,
upperValueString=upperValueString))

View File

@ -48,57 +48,57 @@ type InvTran struct {
}
type InvBuy struct {
XMLName xml.Name `xml:"INVBUY"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
UnitPrice Amount `xml:"UNITPRICE"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
Markup Amount `xml:"MARKUP,omitempty"` // Portion of UNITPRICE that is attributed to the dealer markup
Commission Amount `xml:"COMMISSION,omitempty"`
Taxes Amount `xml:"TAXES,omitempty"`
Fees Amount `xml:"FEES,omitempty"`
Load Amount `xml:"LOAD,omitempty"`
Total Amount `xml:"TOTAL"` // Transaction total. Buys, sells, etc.:((quan. * (price +/- markup/markdown)) +/-(commission + fees + load + taxes + penalty + withholding + statewithholding)). Distributions, interest, margin interest, misc. expense, etc.: amount. Return of cap: cost basis
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
SubAcctFund String `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
XMLName xml.Name `xml:"INVBUY"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
UnitPrice Amount `xml:"UNITPRICE"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
Markup Amount `xml:"MARKUP,omitempty"` // Portion of UNITPRICE that is attributed to the dealer markup
Commission Amount `xml:"COMMISSION,omitempty"`
Taxes Amount `xml:"TAXES,omitempty"`
Fees Amount `xml:"FEES,omitempty"`
Load Amount `xml:"LOAD,omitempty"`
Total Amount `xml:"TOTAL"` // Transaction total. Buys, sells, etc.:((quan. * (price +/- markup/markdown)) +/-(commission + fees + load + taxes + penalty + withholding + statewithholding)). Distributions, interest, margin interest, misc. expense, etc.: amount. Return of cap: cost basis
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
SubAcctFund subAcctType `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
// The next three elements must either all be provided, or none of htem
// The next three elements must either all be provided, or none of them
LoanId String `xml:"LOANID,omitempty"` // For 401(k) accounts only. Indicates that the transaction was due to a loan or a loan repayment, and which loan it was
LoanPrincipal Amount `xml:"LOANPRINCIPAL,omitempty"` // For 401(k) accounts only. Indicates how much of the loan repayment was principal
LoanInterest Amount `xml:"LOANINTEREST,omitempty"` // For 401(k) accounts only. Indicates how much of the loan repayment was interest
Inv401kSource String `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
DtPayroll *Date `xml:"DTPAYROLL,omitempty"` // For 401(k)accounts, date the funds for this transaction was obtained via payroll deduction
PriorYearContrib Boolean `xml:"PRIORYEARCONTRIB,omitempty"` // For 401(k) accounts, indicates that this Buy was made with a prior year contribution
Inv401kSource inv401kSource `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
DtPayroll *Date `xml:"DTPAYROLL,omitempty"` // For 401(k)accounts, date the funds for this transaction was obtained via payroll deduction
PriorYearContrib Boolean `xml:"PRIORYEARCONTRIB,omitempty"` // For 401(k) accounts, indicates that this Buy was made with a prior year contribution
}
type InvSell struct {
XMLName xml.Name `xml:"INVSELL"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
UnitPrice Amount `xml:"UNITPRICE"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
Markdown Amount `xml:"MARKDOWN,omitempty"` // Portion of UNITPRICE that is attributed to the dealer markdown
Commission Amount `xml:"COMMISSION,omitempty"`
Taxes Amount `xml:"TAXES,omitempty"`
Fees Amount `xml:"FEES,omitempty"`
Load Amount `xml:"LOAD,omitempty"`
Witholding Amount `xml:"WITHHOLDING,omitempty"` // Federal tax witholdings
TaxExempt Boolean `xml:"TAXEXEMPT,omitempty"` // Tax-exempt transaction
Total Amount `xml:"TOTAL"` // Transaction total. Buys, sells, etc.:((quan. * (price +/- markup/markdown)) +/-(commission + fees + load + taxes + penalty + withholding + statewithholding)). Distributions, interest, margin interest, misc. expense, etc.: amount. Return of cap: cost basis
Gain Amount `xml:"GAIN,omitempty"` // Total gain
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
SubAcctFund String `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
XMLName xml.Name `xml:"INVSELL"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
UnitPrice Amount `xml:"UNITPRICE"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
Markdown Amount `xml:"MARKDOWN,omitempty"` // Portion of UNITPRICE that is attributed to the dealer markdown
Commission Amount `xml:"COMMISSION,omitempty"`
Taxes Amount `xml:"TAXES,omitempty"`
Fees Amount `xml:"FEES,omitempty"`
Load Amount `xml:"LOAD,omitempty"`
Witholding Amount `xml:"WITHHOLDING,omitempty"` // Federal tax witholdings
TaxExempt Boolean `xml:"TAXEXEMPT,omitempty"` // Tax-exempt transaction
Total Amount `xml:"TOTAL"` // Transaction total. Buys, sells, etc.:((quan. * (price +/- markup/markdown)) +/-(commission + fees + load + taxes + penalty + withholding + statewithholding)). Distributions, interest, margin interest, misc. expense, etc.: amount. Return of cap: cost basis
Gain Amount `xml:"GAIN,omitempty"` // Total gain
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
SubAcctFund subAcctType `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
LoanId String `xml:"LOANID,omitempty"` // For 401(k) accounts only. Indicates that the transaction was due to a loan or a loan repayment, and which loan it was
StateWitholding Amount `xml:"STATEWITHHOLDING,omitempty"` // State tax witholdings
Penalty Amount `xml:"PENALTY,omitempty"` // Amount witheld due to penalty
Inv401kSource String `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
Inv401kSource inv401kSource `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
}
type BuyDebt struct {
@ -114,7 +114,7 @@ func (t BuyDebt) TransactionType() string {
type BuyMF struct {
XMLName xml.Name `xml:"BUYMF"`
InvBuy InvBuy `xml:"INVBUY"`
BuyType String `xml:"BUYTYPE"` // One of BUY, BUYTOCOVER (BUYTOCOVER used to close short sales.)
BuyType buyType `xml:"BUYTYPE"` // One of BUY, BUYTOCOVER (BUYTOCOVER used to close short sales.)
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
}
@ -123,10 +123,10 @@ func (t BuyMF) TransactionType() string {
}
type BuyOpt struct {
XMLName xml.Name `xml:"BUYOPT"`
InvBuy InvBuy `xml:"INVBUY"`
OptBuyType String `xml:"OPTBUYTYPE"` // type of purchase: BUYTOOPEN, BUYTOCLOSE (The BUYTOOPEN buy type is like “ordinary” buying of option and works like stocks.)
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
XMLName xml.Name `xml:"BUYOPT"`
InvBuy InvBuy `xml:"INVBUY"`
OptBuyType optBuyType `xml:"OPTBUYTYPE"` // type of purchase: BUYTOOPEN, BUYTOCLOSE (The BUYTOOPEN buy type is like “ordinary” buying of option and works like stocks.)
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
}
func (t BuyOpt) TransactionType() string {
@ -145,7 +145,7 @@ func (t BuyOther) TransactionType() string {
type BuyStock struct {
XMLName xml.Name `xml:"BUYSTOCK"`
InvBuy InvBuy `xml:"INVBUY"`
BuyType String `xml:"BUYTYPE"` // One of BUY, BUYTOCOVER (BUYTOCOVER used to close short sales.)
BuyType buyType `xml:"BUYTYPE"` // One of BUY, BUYTOCOVER (BUYTOCOVER used to close short sales.)
}
func (t BuyStock) TransactionType() string {
@ -153,15 +153,15 @@ func (t BuyStock) TransactionType() string {
}
type ClosureOpt struct {
XMLName xml.Name `xml:"CLOSUREOPT"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
OptAction String `xml:"OPTACTION"` // One of EXERCISE, ASSIGN, EXPIRE. The EXERCISE action is used to close out an option that is exercised. The ASSIGN action is used when an option writer is assigned. The EXPIRE action is used when the options expired date is reached
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
Gain Amount `xml:"GAIN,omitempty"` // Total gain
XMLName xml.Name `xml:"CLOSUREOPT"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
OptAction optAction `xml:"OPTACTION"` // One of EXERCISE, ASSIGN, EXPIRE. The EXERCISE action is used to close out an option that is exercised. The ASSIGN action is used when an option writer is assigned. The EXPIRE action is used when the options expired date is reached
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
Gain Amount `xml:"GAIN,omitempty"` // Total gain
}
func (t ClosureOpt) TransactionType() string {
@ -170,18 +170,18 @@ func (t ClosureOpt) TransactionType() string {
// Investment income is realized as cash into the investment account
type Income struct {
XMLName xml.Name `xml:"INCOME"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
IncomeType String `xml:"INCOMETYPE"` // Type of investment income: CGLONG (capital gains-long term), CGSHORT (capital gains-short term), DIV (dividend), INTEREST, MISC
Total Amount `xml:"TOTAL"`
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
SubAcctFund String `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
TaxExempt Boolean `xml:"TAXEXEMPT,omitempty"` // Tax-exempt transaction
Witholding Amount `xml:"WITHHOLDING,omitempty"` // Federal tax witholdings
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
Inv401kSource String `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
XMLName xml.Name `xml:"INCOME"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
IncomeType incomeType `xml:"INCOMETYPE"` // Type of investment income: CGLONG (capital gains-long term), CGSHORT (capital gains-short term), DIV (dividend), INTEREST, MISC
Total Amount `xml:"TOTAL"`
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
SubAcctFund subAcctType `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
TaxExempt Boolean `xml:"TAXEXEMPT,omitempty"` // Tax-exempt transaction
Witholding Amount `xml:"WITHHOLDING,omitempty"` // Federal tax witholdings
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
Inv401kSource inv401kSource `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
}
func (t Income) TransactionType() string {
@ -190,15 +190,15 @@ func (t Income) TransactionType() string {
// Expense associated with an investment
type InvExpense struct {
XMLName xml.Name `xml:"INVEXPENSE"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
Total Amount `xml:"TOTAL"`
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
SubAcctFund String `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
Inv401kSource String `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
XMLName xml.Name `xml:"INVEXPENSE"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
Total Amount `xml:"TOTAL"`
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
SubAcctFund subAcctType `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
Inv401kSource inv401kSource `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
}
func (t InvExpense) TransactionType() string {
@ -207,11 +207,11 @@ func (t InvExpense) TransactionType() string {
// Journaling cash holdings between sub-accounts within the same investment account.
type JrnlFund struct {
XMLName xml.Name `xml:"JRNLFUND"`
InvTran InvTran `xml:"INVTRAN"`
Total Amount `xml:"TOTAL"`
SubAcctFrom String `xml:"SUBACCTFROM"` // Sub-account cash is being transferred from: CASH, MARGIN, SHORT, OTHER
SubAcctTo String `xml:"SUBACCTTO"` // Sub-account cash is being transferred to: CASH, MARGIN, SHORT, OTHER
XMLName xml.Name `xml:"JRNLFUND"`
InvTran InvTran `xml:"INVTRAN"`
Total Amount `xml:"TOTAL"`
SubAcctFrom subAcctType `xml:"SUBACCTFROM"` // Sub-account cash is being transferred from: CASH, MARGIN, SHORT, OTHER
SubAcctTo subAcctType `xml:"SUBACCTTO"` // Sub-account cash is being transferred to: CASH, MARGIN, SHORT, OTHER
}
func (t JrnlFund) TransactionType() string {
@ -220,12 +220,12 @@ func (t JrnlFund) TransactionType() string {
// Journaling security holdings between sub-accounts within the same investment account.
type JrnlSec struct {
XMLName xml.Name `xml:"JRNLSEC"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
SubAcctFrom String `xml:"SUBACCTFROM"` // Sub-account cash is being transferred from: CASH, MARGIN, SHORT, OTHER
SubAcctTo String `xml:"SUBACCTTO"` // Sub-account cash is being transferred to: CASH, MARGIN, SHORT, OTHER
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
XMLName xml.Name `xml:"JRNLSEC"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
SubAcctFrom subAcctType `xml:"SUBACCTFROM"` // Sub-account cash is being transferred from: CASH, MARGIN, SHORT, OTHER
SubAcctTo subAcctType `xml:"SUBACCTTO"` // Sub-account cash is being transferred to: CASH, MARGIN, SHORT, OTHER
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
}
func (t JrnlSec) TransactionType() string {
@ -233,12 +233,12 @@ func (t JrnlSec) TransactionType() string {
}
type MarginInterest struct {
XMLName xml.Name `xml:"MARGININTEREST"`
InvTran InvTran `xml:"INVTRAN"`
Total Amount `xml:"TOTAL"`
SubAcctFund String `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
XMLName xml.Name `xml:"MARGININTEREST"`
InvTran InvTran `xml:"INVTRAN"`
Total Amount `xml:"TOTAL"`
SubAcctFund subAcctType `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
}
func (t MarginInterest) TransactionType() string {
@ -247,22 +247,22 @@ func (t MarginInterest) TransactionType() string {
// REINVEST is a single transaction that contains both income and an investment transaction. If servers cant track this as a single transaction they should return an INCOME transaction and an INVTRAN.
type Reinvest struct {
XMLName xml.Name `xml:"REINVEST"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
IncomeType String `xml:"INCOMETYPE"` // Type of investment income: CGLONG (capital gains-long term), CGSHORT (capital gains-short term), DIV (dividend), INTEREST, MISC
Total Amount `xml:"TOTAL"` // Transaction total. Buys, sells, etc.:((quan. * (price +/- markup/markdown)) +/-(commission + fees + load + taxes + penalty + withholding + statewithholding)). Distributions, interest, margin interest, misc. expense, etc.: amount. Return of cap: cost basis
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
UnitPrice Amount `xml:"UNITPRICE"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
Commission Amount `xml:"COMMISSION,omitempty"`
Taxes Amount `xml:"TAXES,omitempty"`
Fees Amount `xml:"FEES,omitempty"`
Load Amount `xml:"LOAD,omitempty"`
TaxExempt Boolean `xml:"TAXEXEMPT,omitempty"` // Tax-exempt transaction
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
Inv401kSource String `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
XMLName xml.Name `xml:"REINVEST"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
IncomeType incomeType `xml:"INCOMETYPE"` // Type of investment income: CGLONG (capital gains-long term), CGSHORT (capital gains-short term), DIV (dividend), INTEREST, MISC
Total Amount `xml:"TOTAL"` // Transaction total. Buys, sells, etc.:((quan. * (price +/- markup/markdown)) +/-(commission + fees + load + taxes + penalty + withholding + statewithholding)). Distributions, interest, margin interest, misc. expense, etc.: amount. Return of cap: cost basis
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
UnitPrice Amount `xml:"UNITPRICE"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
Commission Amount `xml:"COMMISSION,omitempty"`
Taxes Amount `xml:"TAXES,omitempty"`
Fees Amount `xml:"FEES,omitempty"`
Load Amount `xml:"LOAD,omitempty"`
TaxExempt Boolean `xml:"TAXEXEMPT,omitempty"` // Tax-exempt transaction
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
Inv401kSource inv401kSource `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
}
func (t Reinvest) TransactionType() string {
@ -270,15 +270,15 @@ func (t Reinvest) TransactionType() string {
}
type RetOfCap struct {
XMLName xml.Name `xml:"RETOFCAP"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
Total Amount `xml:"TOTAL"`
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
SubAcctFund String `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
Inv401kSource String `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
XMLName xml.Name `xml:"RETOFCAP"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
Total Amount `xml:"TOTAL"`
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
SubAcctFund subAcctType `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
Inv401kSource inv401kSource `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
}
func (t RetOfCap) TransactionType() string {
@ -286,10 +286,10 @@ func (t RetOfCap) TransactionType() string {
}
type SellDebt struct {
XMLName xml.Name `xml:"SELLDEBT"`
InvSell InvSell `xml:"INVSELL"`
SellReason String `xml:"SELLREASON"` // CALL (the debt was called), SELL (the debt was sold), MATURITY (the debt reached maturity)
AccrdInt Amount `xml:"ACCRDINT,omitempty"` // Accrued interest
XMLName xml.Name `xml:"SELLDEBT"`
InvSell InvSell `xml:"INVSELL"`
SellReason sellReason `xml:"SELLREASON"` // CALL (the debt was called), SELL (the debt was sold), MATURITY (the debt reached maturity)
AccrdInt Amount `xml:"ACCRDINT,omitempty"` // Accrued interest
}
func (t SellDebt) TransactionType() string {
@ -299,7 +299,7 @@ func (t SellDebt) TransactionType() string {
type SellMF struct {
XMLName xml.Name `xml:"SELLMF"`
InvSell InvSell `xml:"INVSELL"`
SellType String `xml:"SELLTYPE"` // Type of sell. SELL, SELLSHORT
SellType sellType `xml:"SELLTYPE"` // Type of sell. SELL, SELLSHORT
AvgCostBasis Amount `xml:"AVGCOSTBASIS"`
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
}
@ -309,13 +309,13 @@ func (t SellMF) TransactionType() string {
}
type SellOpt struct {
XMLName xml.Name `xml:"SELLOPT"`
InvSell InvSell `xml:"INVSELL"`
OptSellType String `xml:"OPTSELLTYPE"` // For options, type of sell: SELLTOCLOSE, SELLTOOPEN. The SELLTOCLOSE action is selling a previously bought option. The SELLTOOPEN action is writing an option
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
RelType String `xml:"RELTYPE,omitempty"` // Related option transaction type: SPREAD, STRADDLE, NONE, OTHER
Secured String `xml:"SECURED,omitempty"` // NAKED, COVERED
XMLName xml.Name `xml:"SELLOPT"`
InvSell InvSell `xml:"INVSELL"`
OptSellType optSellType `xml:"OPTSELLTYPE"` // For options, type of sell: SELLTOCLOSE, SELLTOOPEN. The SELLTOCLOSE action is selling a previously bought option. The SELLTOOPEN action is writing an option
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
RelType relType `xml:"RELTYPE,omitempty"` // Related option transaction type: SPREAD, STRADDLE, NONE, OTHER
Secured secured `xml:"SECURED,omitempty"` // NAKED, COVERED
}
func (t SellOpt) TransactionType() string {
@ -334,7 +334,7 @@ func (t SellOther) TransactionType() string {
type SellStock struct {
XMLName xml.Name `xml:"SELLSTOCK"`
InvSell InvSell `xml:"INVSELL"`
SellType String `xml:"SELLTYPE"` // Type of sell. SELL, SELLSHORT
SellType sellType `xml:"SELLTYPE"` // Type of sell. SELL, SELLSHORT
}
func (t SellStock) TransactionType() string {
@ -342,19 +342,19 @@ func (t SellStock) TransactionType() string {
}
type Split struct {
XMLName xml.Name `xml:"SPLIT"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
OldUnits Amount `xml:"OLDUNITS"` // number of shares before the split
NewUnits Amount `xml:"NEWUNITS"` // number of shares after the split
Numerator Int `xml:"NUMERATOR"` // split ratio numerator
Denominator Int `xml:"DENOMINATOR"` // split ratio denominator
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
FracCash Amount `xml:"FRACCASH,omitempty"` // cash for fractional units
SubAcctFund String `xml:"SUBACCTFUND,omitempty"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
Inv401kSource String `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
XMLName xml.Name `xml:"SPLIT"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
OldUnits Amount `xml:"OLDUNITS"` // number of shares before the split
NewUnits Amount `xml:"NEWUNITS"` // number of shares after the split
Numerator Int `xml:"NUMERATOR"` // split ratio numerator
Denominator Int `xml:"DENOMINATOR"` // split ratio denominator
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
FracCash Amount `xml:"FRACCASH,omitempty"` // cash for fractional units
SubAcctFund subAcctType `xml:"SUBACCTFUND,omitempty"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
Inv401kSource inv401kSource `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
}
func (t Split) TransactionType() string {
@ -362,18 +362,18 @@ func (t Split) TransactionType() string {
}
type Transfer struct {
XMLName xml.Name `xml:"TRANSFER"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
TferAction String `xml:"TFERACTION"` // One of IN, OUT
PosType String `xml:"POSTYPE"` // Position type. One of LONG, SHORT
InvAcctFrom InvAcct `xml:"INVACCTFROM,omitempty"`
AvgCostBasis Amount `xml:"AVGCOSTBASIS,omitempty"`
UnitPrice Amount `xml:"UNITPRICE,omitempty"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
DtPurchase *Date `xml:"DTPURCHASE,omitempty"`
Inv401kSource String `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
XMLName xml.Name `xml:"TRANSFER"`
InvTran InvTran `xml:"INVTRAN"`
SecId SecurityId `xml:"SECID"`
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
TferAction tferAction `xml:"TFERACTION"` // One of IN, OUT
PosType posType `xml:"POSTYPE"` // Position type. One of LONG, SHORT
InvAcctFrom InvAcct `xml:"INVACCTFROM,omitempty"`
AvgCostBasis Amount `xml:"AVGCOSTBASIS,omitempty"`
UnitPrice Amount `xml:"UNITPRICE,omitempty"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
DtPurchase *Date `xml:"DTPURCHASE,omitempty"`
Inv401kSource inv401kSource `xml:"INV401KSOURCE,omitempty"` // Source of money for this transaction. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
}
func (t Transfer) TransactionType() string {
@ -387,7 +387,7 @@ type InvTransaction interface {
type InvBankTransaction struct {
XMLName xml.Name `xml:"INVBANKTRAN"`
Transactions []Transaction `xml:"STMTTRN,omitempty"`
SubAcctFund String `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
SubAcctFund subAcctType `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
}
// Must be unmarshalled manually due to the structure (don't know what kind of
@ -557,18 +557,18 @@ func (l *InvTranList) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
}
type InvPosition struct {
XMLName xml.Name `xml:"INVPOS"`
SecId SecurityId `xml:"SECID"`
HeldInAcct String `xml:"HELDINACCT"` // Sub-account type, one of CASH, MARGIN, SHORT, OTHER
PosType String `xml:"POSTYPE"` // SHORT = Writer for options, Short for all others; LONG = Holder for options, Long for all others.
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
UnitPrice Amount `xml:"UNITPRICE"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
MktVal Amount `xml:"MKTVAL"` // Market value of this position
AvgCostBasis Amount `xml:"AVGCOSTBASIS,omitempty"` //
DtPriceAsOf Date `xml:"DTPRICEASOF"` // Date and time of unit price and market value, and cost basis. If this date is unknown, use 19900101 as the placeholder; do not use 0,
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
Memo String `xml:"MEMO,omitempty"`
Inv401kSource String `xml:"INV401KSOURCE,omitempty"` // One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
XMLName xml.Name `xml:"INVPOS"`
SecId SecurityId `xml:"SECID"`
HeldInAcct subAcctType `xml:"HELDINACCT"` // Sub-account type, one of CASH, MARGIN, SHORT, OTHER
PosType posType `xml:"POSTYPE"` // SHORT = Writer for options, Short for all others; LONG = Holder for options, Long for all others.
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
UnitPrice Amount `xml:"UNITPRICE"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
MktVal Amount `xml:"MKTVAL"` // Market value of this position
AvgCostBasis Amount `xml:"AVGCOSTBASIS,omitempty"` //
DtPriceAsOf Date `xml:"DTPRICEASOF"` // Date and time of unit price and market value, and cost basis. If this date is unknown, use 19900101 as the placeholder; do not use 0,
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
Memo String `xml:"MEMO,omitempty"`
Inv401kSource inv401kSource `xml:"INV401KSOURCE,omitempty"` // One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
}
type Position interface {
@ -600,7 +600,7 @@ func (p MFPosition) PositionType() string {
type OptPosition struct {
XMLName xml.Name `xml:"POSOPT"`
InvPos InvPosition `xml:"INVPOS"`
Secured String `xml:"SECURED,omitempty"` // One of NAKED, COVERED
Secured secured `xml:"SECURED,omitempty"` // One of NAKED, COVERED
}
func (p OptPosition) PositionType() string {
@ -689,21 +689,21 @@ type InvBalance struct {
}
type OO struct {
XMLName xml.Name `xml:"OO"`
FiTId String `xml:"FITID"`
SrvrTId String `xml:"SRVRTID,omitempty"`
SecId SecurityId `xml:"SECID"`
DtPlaced Date `xml:"DTPLACED"` // Date the order was placed
Units Amount `xml:"UNITS"` // Quantity of the security the open order is for
SubAcct String `xml:"SUBACCT"` // One of CASH, MARGIN, SHORT, OTHER
Duration String `xml:"DURATION"` // How long the order is good for. One of DAY, GOODTILCANCEL, IMMEDIATE
Restriction String `xml:"RESTRICTION"` // Special restriction on the order: One of ALLORNONE, MINUNITS, NONE
MinUnits Amount `xml:"MINUNITS,omitempty"` // Minimum number of units that must be filled for the order
LimitPrice Amount `xml:"LIMITPRICE,omitempty"`
StopPrice Amount `xml:"STOPPRICE,omitempty"`
Memo String `xml:"MEMO,omitempty"`
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
Inv401kSource String `xml:"INV401KSOURCE,omitempty"` // One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
XMLName xml.Name `xml:"OO"`
FiTId String `xml:"FITID"`
SrvrTId String `xml:"SRVRTID,omitempty"`
SecId SecurityId `xml:"SECID"`
DtPlaced Date `xml:"DTPLACED"` // Date the order was placed
Units Amount `xml:"UNITS"` // Quantity of the security the open order is for
SubAcct subAcctType `xml:"SUBACCT"` // One of CASH, MARGIN, SHORT, OTHER
Duration duration `xml:"DURATION"` // How long the order is good for. One of DAY, GOODTILCANCEL, IMMEDIATE
Restriction restriction `xml:"RESTRICTION"` // Special restriction on the order: One of ALLORNONE, MINUNITS, NONE
MinUnits Amount `xml:"MINUNITS,omitempty"` // Minimum number of units that must be filled for the order
LimitPrice Amount `xml:"LIMITPRICE,omitempty"`
StopPrice Amount `xml:"STOPPRICE,omitempty"`
Memo String `xml:"MEMO,omitempty"`
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
Inv401kSource inv401kSource `xml:"INV401KSOURCE,omitempty"` // One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST for 401(k) accounts. Default if not present is OTHERNONVEST. The following cash source types are subject to vesting: MATCH, PROFITSHARING, and OTHERVEST
}
type OpenOrder interface {
@ -724,8 +724,8 @@ func (o OOBuyDebt) OrderType() string {
type OOBuyMF struct {
XMLName xml.Name `xml:"OOBUYMF"`
OO OO `xml:"OO"`
BuyType String `xml:"BUYTYPE"` // One of BUY, BUYTOCOVER
UnitType String `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
BuyType buyType `xml:"BUYTYPE"` // One of BUY, BUYTOCOVER
UnitType unitType `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
}
func (o OOBuyMF) OrderType() string {
@ -733,9 +733,9 @@ func (o OOBuyMF) OrderType() string {
}
type OOBuyOpt struct {
XMLName xml.Name `xml:"OOBUYOPT"`
OO OO `xml:"OO"`
OptBuyType String `xml:"OPTBUYTYPE"` // One of BUYTOOPEN, BUYTOCLOSE
XMLName xml.Name `xml:"OOBUYOPT"`
OO OO `xml:"OO"`
OptBuyType optBuyType `xml:"OPTBUYTYPE"` // One of BUYTOOPEN, BUYTOCLOSE
}
func (o OOBuyOpt) OrderType() string {
@ -745,7 +745,7 @@ func (o OOBuyOpt) OrderType() string {
type OOBuyOther struct {
XMLName xml.Name `xml:"OOBUYOTHER"`
OO OO `xml:"OO"`
UnitType String `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
UnitType unitType `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
}
func (o OOBuyOther) OrderType() string {
@ -755,7 +755,7 @@ func (o OOBuyOther) OrderType() string {
type OOBuyStock struct {
XMLName xml.Name `xml:"OOBUYSTOCK"`
OO OO `xml:"OO"`
BuyType String `xml:"BUYTYPE"` // One of BUY, BUYTOCOVER
BuyType buyType `xml:"BUYTYPE"` // One of BUY, BUYTOCOVER
}
func (o OOBuyStock) OrderType() string {
@ -774,8 +774,8 @@ func (o OOSellDebt) OrderType() string {
type OOSellMF struct {
XMLName xml.Name `xml:"OOSELLMF"`
OO OO `xml:"OO"`
SellType String `xml:"SELLTYPE"` // One of SELL, SELLSHORT
UnitType String `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
SellType sellType `xml:"SELLTYPE"` // One of SELL, SELLSHORT
UnitType unitType `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
SellAll Boolean `xml:"SELLALL"` // Sell entire holding
}
@ -784,9 +784,9 @@ func (o OOSellMF) OrderType() string {
}
type OOSellOpt struct {
XMLName xml.Name `xml:"OOSELLOPT"`
OO OO `xml:"OO"`
OptSellType String `xml:"OPTSELLTYPE"` // One of SELLTOOPEN, SELLTOCLOSE
XMLName xml.Name `xml:"OOSELLOPT"`
OO OO `xml:"OO"`
OptSellType optSellType `xml:"OPTSELLTYPE"` // One of SELLTOOPEN, SELLTOCLOSE
}
func (o OOSellOpt) OrderType() string {
@ -796,7 +796,7 @@ func (o OOSellOpt) OrderType() string {
type OOSellOther struct {
XMLName xml.Name `xml:"OOSELLOTHER"`
OO OO `xml:"OO"`
UnitType String `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
UnitType unitType `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
}
func (o OOSellOther) OrderType() string {
@ -806,7 +806,7 @@ func (o OOSellOther) OrderType() string {
type OOSellStock struct {
XMLName xml.Name `xml:"OOSELLSTOCK"`
OO OO `xml:"OO"`
SellType String `xml:"SELLTYPE"` // One of SELL, SELLSHORT
SellType sellType `xml:"SELLTYPE"` // One of SELL, SELLSHORT
}
func (o OOSellStock) OrderType() string {
@ -817,7 +817,7 @@ type OOSwitchMF struct {
XMLName xml.Name `xml:"SWITCHMF"`
OO OO `xml:"OO"`
SecId SecurityId `xml:"SECID"` // Security ID of the fund to switch to or purchase
UnitType String `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
UnitType unitType `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
SwitchAll Boolean `xml:"SWITCHALL"` // Switch entire holding
}
@ -938,22 +938,22 @@ type VestInfo struct {
}
type LoanInfo struct {
XMLName xml.Name `xml:"VESTINFO"`
LoanID String `xml:"LOANID"` // Identifier of this loan
LoanDesc String `xml:"LOANDESC,omitempty"` // Loan description
InitialLoanBal Amount `xml:"INITIALLOANBAL,omitempty"` // Initial loan balance
LoanStartDate *Date `xml:"LOANSTARTDATE,omitempty"` // Start date of loan
CurrentLoanBal Amount `xml:"CURRENTLOANBAL"` // Current loan principal balance
DtAsOf *Date `xml:"DTASOF"` // Date and time of the current loan balance
LoanRate Amount `xml:"LOANRATE,omitempty"` // Loan annual interest rate
LoanPmtAmt Amount `xml:"LOANPMTAMT,omitempty"` // Loan payment amount
LoanPmtFreq String `xml:"LOANPMTFREQ,omitempty"` // Frequency of loan repayments: WEEKLY, BIWEEKLY, TWICEMONTHLY, MONTHLY, FOURWEEKS, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY, OTHER. See section 10.2.1 for calculation rules.
LoanPmtsInitial Int `xml:"LOANPMTSINITIAL,omitempty"` // Initial number of loan payments.
LoanPmtsRemaining Int `xml:"LOANPMTSREMAINING,omitempty"` // Remaining number of loan payments
LoanMaturityDate *Date `xml:"LOANMATURITYDATE,omitempty"` // Expected loan end date
LoanTotalProjInterest Amount `xml:"LOANTOTALPROJINTEREST,omitempty"` // Total projected interest to be paid on this loan
LoanInterestToDate Amount `xml:"LOANINTERESTTODATE,omitempty"` // Total interested paid to date on this loan
LoanExtPmtDate *Date `xml:"LOANNEXTPMTDATE,omitempty"` // Next payment due date
XMLName xml.Name `xml:"VESTINFO"`
LoanID String `xml:"LOANID"` // Identifier of this loan
LoanDesc String `xml:"LOANDESC,omitempty"` // Loan description
InitialLoanBal Amount `xml:"INITIALLOANBAL,omitempty"` // Initial loan balance
LoanStartDate *Date `xml:"LOANSTARTDATE,omitempty"` // Start date of loan
CurrentLoanBal Amount `xml:"CURRENTLOANBAL"` // Current loan principal balance
DtAsOf *Date `xml:"DTASOF"` // Date and time of the current loan balance
LoanRate Amount `xml:"LOANRATE,omitempty"` // Loan annual interest rate
LoanPmtAmt Amount `xml:"LOANPMTAMT,omitempty"` // Loan payment amount
LoanPmtFreq loanPmtFreq `xml:"LOANPMTFREQ,omitempty"` // Frequency of loan repayments: WEEKLY, BIWEEKLY, TWICEMONTHLY, MONTHLY, FOURWEEKS, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY, OTHER. See section 10.2.1 for calculation rules.
LoanPmtsInitial Int `xml:"LOANPMTSINITIAL,omitempty"` // Initial number of loan payments.
LoanPmtsRemaining Int `xml:"LOANPMTSREMAINING,omitempty"` // Remaining number of loan payments
LoanMaturityDate *Date `xml:"LOANMATURITYDATE,omitempty"` // Expected loan end date
LoanTotalProjInterest Amount `xml:"LOANTOTALPROJINTEREST,omitempty"` // Total projected interest to be paid on this loan
LoanInterestToDate Amount `xml:"LOANINTERESTTODATE,omitempty"` // Total interested paid to date on this loan
LoanExtPmtDate *Date `xml:"LOANNEXTPMTDATE,omitempty"` // Next payment due date
}
type Inv401KSummaryAggregate struct {

View File

@ -331,17 +331,17 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
UnitPrice: unitprice1,
Commission: commission1,
Total: total1,
SubAcctSec: "CASH",
SubAcctFund: "CASH",
SubAcctSec: ofxgo.SubAcctTypeCash,
SubAcctFund: ofxgo.SubAcctTypeCash,
},
BuyType: "BUY",
BuyType: ofxgo.BuyTypeBuy,
},
},
BankTransactions: []ofxgo.InvBankTransaction{
ofxgo.InvBankTransaction{
Transactions: []ofxgo.Transaction{
ofxgo.Transaction{
TrnType: "CREDIT",
TrnType: ofxgo.TrnTypeCredit,
DtPosted: *ofxgo.NewDateGMT(2017, 1, 20, 0, 0, 0, 0),
DtUser: ofxgo.NewDateGMT(2017, 1, 18, 0, 0, 0, 0),
DtAvail: ofxgo.NewDateGMT(2017, 1, 23, 0, 0, 0, 0),
@ -352,7 +352,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
Memo: "CHECK 19980",
},
},
SubAcctFund: "CASH",
SubAcctFund: ofxgo.SubAcctTypeCash,
},
},
}
@ -371,7 +371,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
ofxgo.Balance{
Name: "Sweep Int Rate",
Desc: "Current interest rate for sweep account balances",
BalType: "PERCENT",
BalType: ofxgo.BalTypePercent,
Value: balvalue,
DtAsOf: ofxgo.NewDateGMT(2017, 4, 1, 0, 0, 0, 0),
},
@ -412,8 +412,8 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
UniqueId: "78462F103",
UniqueIdType: "CUSIP",
},
HeldInAcct: "CASH",
PosType: "LONG",
HeldInAcct: ofxgo.SubAcctTypeCash,
PosType: ofxgo.PosTypeLong,
Units: posunits1,
UnitPrice: posunitprice1,
MktVal: posmktval1,
@ -427,8 +427,8 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
UniqueId: "129887339",
UniqueIdType: "CUSIP",
},
HeldInAcct: "CASH",
PosType: "LONG",
HeldInAcct: ofxgo.SubAcctTypeCash,
PosType: ofxgo.PosTypeLong,
Units: posunits2,
UnitPrice: posunitprice2,
MktVal: posmktval2,
@ -447,13 +447,13 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
},
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
Units: oounits1,
SubAcct: "CASH",
Duration: "GOODTILCANCEL",
Restriction: "NONE",
SubAcct: ofxgo.SubAcctTypeCash,
Duration: ofxgo.DurationGoodTilCancel,
Restriction: ofxgo.RestrictionNone,
LimitPrice: oolimitprice1,
},
BuyType: "BUY",
UnitType: "SHARES",
BuyType: ofxgo.BuyTypeBuy,
UnitType: ofxgo.UnitTypeShares,
},
ofxgo.OOBuyStock{
OO: ofxgo.OO{
@ -464,12 +464,12 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
},
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
Units: oounits2,
SubAcct: "CASH",
Duration: "GOODTILCANCEL",
Restriction: "ALLORNONE",
SubAcct: ofxgo.SubAcctTypeCash,
Duration: ofxgo.DurationGoodTilCancel,
Restriction: ofxgo.RestrictionAllOrNone,
LimitPrice: oolimitprice2,
},
BuyType: "BUY",
BuyType: ofxgo.BuyTypeBuy,
},
},
}
@ -493,7 +493,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
FiId: "99184",
},
Yield: yield1,
AssetClass: "OTHER",
AssetClass: ofxgo.AssetClassOther,
},
ofxgo.OptInfo{
SecInfo: ofxgo.SecInfo{
@ -505,7 +505,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
Ticker: "FERTP",
FiId: "882919",
},
OptType: "PUT",
OptType: ofxgo.OptTypePut,
StrikePrice: strikeprice,
DtExpire: *ofxgo.NewDateGMT(2017, 9, 1, 0, 0, 0, 0),
ShPerCtrct: 100,
@ -513,7 +513,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
UniqueId: "983322180",
UniqueIdType: "CUSIP",
},
AssetClass: "LARGESTOCK",
AssetClass: ofxgo.AssetClassLargeStock,
},
ofxgo.StockInfo{
SecInfo: ofxgo.SecInfo{
@ -526,7 +526,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
FiId: "883897",
},
Yield: yield2,
AssetClass: "SMALLSTOCK",
AssetClass: ofxgo.AssetClassSmallStock,
},
ofxgo.MFInfo{
SecInfo: ofxgo.SecInfo{
@ -754,10 +754,10 @@ NEWFILEUID: NONE
Commission: commission1,
Fees: fees1,
Total: total1,
SubAcctSec: "CASH",
SubAcctFund: "CASH",
SubAcctSec: ofxgo.SubAcctTypeCash,
SubAcctFund: ofxgo.SubAcctTypeCash,
},
OptSellType: "SELLTOOPEN",
OptSellType: ofxgo.OptSellTypeSellToOpen,
ShPerCtrct: 100,
},
ofxgo.ClosureOpt{
@ -770,10 +770,10 @@ NEWFILEUID: NONE
UniqueId: "78462F10",
UniqueIdType: "CUSIP",
},
OptAction: "ASSIGN",
OptAction: ofxgo.OptActionAssign,
Units: units2,
ShPerCtrct: 100,
SubAcctSec: "CASH",
SubAcctSec: ofxgo.SubAcctTypeCash,
},
ofxgo.ClosureOpt{
InvTran: ofxgo.InvTran{
@ -785,10 +785,10 @@ NEWFILEUID: NONE
UniqueId: "SPY161216C00226000",
UniqueIdType: "CUSIP",
},
OptAction: "ASSIGN",
OptAction: ofxgo.OptActionAssign,
Units: units3,
ShPerCtrct: 100,
SubAcctSec: "CASH",
SubAcctSec: ofxgo.SubAcctTypeCash,
},
},
}
@ -832,8 +832,8 @@ NEWFILEUID: NONE
UniqueId: "04956010",
UniqueIdType: "CUSIP",
},
HeldInAcct: "CASH",
PosType: "LONG",
HeldInAcct: ofxgo.SubAcctTypeCash,
PosType: ofxgo.PosTypeLong,
Units: posunits1,
UnitPrice: posunitprice1,
MktVal: posmktval1,
@ -846,8 +846,8 @@ NEWFILEUID: NONE
UniqueId: "36960410",
UniqueIdType: "CUSIP",
},
HeldInAcct: "CASH",
PosType: "LONG",
HeldInAcct: ofxgo.SubAcctTypeCash,
PosType: ofxgo.PosTypeLong,
Units: posunits2,
UnitPrice: posunitprice2,
MktVal: posmktval2,
@ -883,7 +883,7 @@ NEWFILEUID: NONE
SecName: "SPY Dec 16 2016 226.00 Call",
Ticker: "SPY 161216C00226000",
},
OptType: "CALL",
OptType: ofxgo.OptTypeCall,
StrikePrice: strikeprice,
DtExpire: *ofxgo.NewDateGMT(2016, 12, 16, 12, 0, 0, 0),
ShPerCtrct: 100,

View File

@ -34,7 +34,7 @@ type SignonInfo struct {
SignonRealm String `xml:"SIGNONREALM"`
Min Int `xml:"MIN"` // Minimum number of password characters
Max Int `xml:"MAX"` // Maximum number of password characters
CharType String `xml:"CHARTYPE"` // ALPHAONLY, NUMERICONLY, ALPHAORNUMERIC, ALPHAANDNUMERIC
CharType charType `xml:"CHARTYPE"` // One of ALPHAONLY, NUMERICONLY, ALPHAORNUMERIC, ALPHAANDNUMERIC
CaseSen Boolean `xml:"CASESEN"` // Password is case-sensitive?
Special Boolean `xml:"SPECIAL"` // Special characters allowed?
Spaces Boolean `xml:"SPACES"` // Spaces allowed?
@ -56,11 +56,11 @@ type MessageSet struct {
Name string // <xxxMSGSETVn> (copy of XMLName.Local)
Ver Int `xml:"MSGSETCORE>VER"` // Message set version - should always match 'n' in <xxxMSGSETVn>
Url String `xml:"MSGSETCORE>URL"` // URL where messages in this set are to be set
OfxSec String `xml:"MSGSETCORE>OFXSEC"` // NONE or 'TYPE 1'
OfxSec ofxSec `xml:"MSGSETCORE>OFXSEC"` // NONE or 'TYPE 1'
TranspSec Boolean `xml:"MSGSETCORE>TRANSPSEC"` // Transport-level security must be used
SignonRealm String `xml:"MSGSETCORE>SIGNONREALM"` // Used to identify which SignonInfo to use for to this MessageSet
Language []String `xml:"MSGSETCORE>LANGUAGE"` // List of supported languages
SyncMode String `xml:"MSGSETCORE>SYNCMODE"` // One of FULL, LITE
SyncMode syncMode `xml:"MSGSETCORE>SYNCMODE"` // One of FULL, LITE
RefreshSupt Boolean `xml:"MSGSETCORE>REFRESHSUPT,omitempty"` // Y if server supports <REFRESH>Y within synchronizations. This option is irrelevant for full synchronization servers. Clients must ignore <REFRESHSUPT> (or its absence) if the profile also specifies <SYNCMODE>FULL. For lite synchronization, the default is N. Without <REFRESHSUPT>Y, lite synchronization servers are not required to support <REFRESH>Y requests
RespFileER Boolean `xml:"MSGSETCORE>RESPFILEER"` // server supports file-based error recovery
SpName String `xml:"MSGSETCORE>SPNAME"` // Name of service provider

View File

@ -233,11 +233,11 @@ NEWFILEUID:NONE
Name: "SIGNONMSGSETV1",
Ver: 1,
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
OfxSec: "NONE",
OfxSec: ofxgo.OfxSecNone,
TranspSec: true,
SignonRealm: "Example Trade",
Language: []ofxgo.String{"ENG"},
SyncMode: "LITE",
SyncMode: ofxgo.SyncModeLite,
RespFileER: false,
// Ignored: <INTU.TIMEOUT>300
},
@ -245,11 +245,11 @@ NEWFILEUID:NONE
Name: "SIGNUPMSGSETV1",
Ver: 1,
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
OfxSec: "NONE",
OfxSec: ofxgo.OfxSecNone,
TranspSec: true,
SignonRealm: "Example Trade",
Language: []ofxgo.String{"ENG"},
SyncMode: "LITE",
SyncMode: ofxgo.SyncModeLite,
RespFileER: false,
// Ignored: <INTU.TIMEOUT>300
},
@ -257,11 +257,11 @@ NEWFILEUID:NONE
Name: "INVSTMTMSGSETV1",
Ver: 1,
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
OfxSec: "NONE",
OfxSec: ofxgo.OfxSecNone,
TranspSec: true,
SignonRealm: "Example Trade",
Language: []ofxgo.String{"ENG"},
SyncMode: "LITE",
SyncMode: ofxgo.SyncModeLite,
RespFileER: false,
// Ignored: <INTU.TIMEOUT>300
},
@ -269,11 +269,11 @@ NEWFILEUID:NONE
Name: "SECLISTMSGSETV1",
Ver: 1,
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
OfxSec: "NONE",
OfxSec: ofxgo.OfxSecNone,
TranspSec: true,
SignonRealm: "Example Trade",
Language: []ofxgo.String{"ENG"},
SyncMode: "LITE",
SyncMode: ofxgo.SyncModeLite,
RespFileER: false,
// Ignored: <INTU.TIMEOUT>300
},
@ -281,11 +281,11 @@ NEWFILEUID:NONE
Name: "PROFMSGSETV1",
Ver: 1,
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
OfxSec: "NONE",
OfxSec: ofxgo.OfxSecNone,
TranspSec: true,
SignonRealm: "Example Trade",
Language: []ofxgo.String{"ENG"},
SyncMode: "LITE",
SyncMode: ofxgo.SyncModeLite,
RespFileER: false,
// Ignored: <INTU.TIMEOUT>300
},
@ -295,7 +295,7 @@ NEWFILEUID:NONE
SignonRealm: "Example Trade",
Min: 1,
Max: 32,
CharType: "ALPHAORNUMERIC",
CharType: ofxgo.CharTypeAlphaOrNumeric,
CaseSen: false,
Special: true,
Spaces: false,

View File

@ -121,6 +121,10 @@ func checkEqual(t *testing.T, fieldName string, expected, actual reflect.Value)
if expected.String() != actual.String() {
t.Fatalf("%s: %s expected to be '%s', found '%s'\n", t.Name(), fieldName, expected.String(), actual.String())
}
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
if expected.Uint() != actual.Uint() {
t.Fatalf("%s: %s expected to be '%s', found '%s'\n", t.Name(), fieldName, valueToString(expected), valueToString(actual))
}
default:
t.Fatalf("%s: %s has unexpected type that didn't provide an Equal() method: %s\n", t.Name(), fieldName, expected.Type().Name())
}

View File

@ -81,22 +81,22 @@ type SecInfo struct {
}
type DebtInfo struct {
XMLName xml.Name `xml:"DEBTINFO"`
SecInfo SecInfo `xml:"SECINFO"`
ParValue Amount `xml:"PARVALUE"`
DebtType String `xml:"DEBTTYPE"` // One of COUPON, ZERO (zero coupon)
DebtClass String `xml:"DEBTCLASS,omitempty"` // One of TREASURY, MUNICIPAL, CORPORATE, OTHER
CouponRate Amount `xml:"COUPONRT,omitempty"` // Bond coupon rate for next closest call date
DtCoupon *Date `xml:"DTCOUPON,omitempty"` // Maturity date for next coupon
CouponFreq String `xml:"COUPONFREQ,omitempty"` // When coupons mature - one of MONTHLY, QUARTERLY, SEMIANNUAL, ANNUAL, or OTHER
CallPrice Amount `xml:"CALLPRICE,omitempty"` // Bond call price
YieldToCall Amount `xml:"YIELDTOCALL,omitempty"` // Yield to next call
DtCall *Date `xml:"DTCALL,omitempty"` // Next call date
CallType String `xml:"CALLTYPE,omitempt"` // Type of next call. One of CALL, PUT, PREFUND, MATURITY
YieldToMat Amount `xml:"YIELDTOMAT,omitempty"` // Yield to maturity
DtMat *Date `xml:"DTMAT,omitempty"` // Debt maturity date
AssetClass String `xml:"ASSETCLASS,omitempty"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
XMLName xml.Name `xml:"DEBTINFO"`
SecInfo SecInfo `xml:"SECINFO"`
ParValue Amount `xml:"PARVALUE"`
DebtType debtType `xml:"DEBTTYPE"` // One of COUPON, ZERO (zero coupon)
DebtClass debtClass `xml:"DEBTCLASS,omitempty"` // One of TREASURY, MUNICIPAL, CORPORATE, OTHER
CouponRate Amount `xml:"COUPONRT,omitempty"` // Bond coupon rate for next closest call date
DtCoupon *Date `xml:"DTCOUPON,omitempty"` // Maturity date for next coupon
CouponFreq couponFreq `xml:"COUPONFREQ,omitempty"` // When coupons mature - one of MONTHLY, QUARTERLY, SEMIANNUAL, ANNUAL, or OTHER
CallPrice Amount `xml:"CALLPRICE,omitempty"` // Bond call price
YieldToCall Amount `xml:"YIELDTOCALL,omitempty"` // Yield to next call
DtCall *Date `xml:"DTCALL,omitempty"` // Next call date
CallType callType `xml:"CALLTYPE,omitempt"` // Type of next call. One of CALL, PUT, PREFUND, MATURITY
YieldToMat Amount `xml:"YIELDTOMAT,omitempty"` // Yield to maturity
DtMat *Date `xml:"DTMAT,omitempty"` // Debt maturity date
AssetClass assetClass `xml:"ASSETCLASS,omitempty"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
}
func (i DebtInfo) SecurityType() string {
@ -104,9 +104,9 @@ func (i DebtInfo) SecurityType() string {
}
type AssetPortion struct {
XMLName xml.Name `xml:"PORTION"`
AssetClass String `xml:"ASSETCLASS"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
Percent Amount `xml:"PERCENT"` // Percentage of the fund that falls under this asset class
XMLName xml.Name `xml:"PORTION"`
AssetClass assetClass `xml:"ASSETCLASS"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
Percent Amount `xml:"PERCENT"` // Percentage of the fund that falls under this asset class
}
type FiAssetPortion struct {
@ -118,7 +118,7 @@ type FiAssetPortion struct {
type MFInfo struct {
XMLName xml.Name `xml:"MFINFO"`
SecInfo SecInfo `xml:"SECINFO"`
MfType String `xml:"MFTYPE"` // One of OPEN, END, CLOSEEND, OTHER
MfType mfType `xml:"MFTYPE"` // One of OPEN, END, CLOSEEND, OTHER
Yield Amount `xml:"YIELD,omitempty"` // Current yield reported as the dividend expressed as a portion of the current stock price
DtYieldAsOf *Date `xml:"DTYIELDASOF,omitempty"` // Date YIELD is valid for
AssetClasses []AssetPortion `xml:"MFASSETCLASS>PORTION"`
@ -132,12 +132,12 @@ func (i MFInfo) SecurityType() string {
type OptInfo struct {
XMLName xml.Name `xml:"OPTINFO"`
SecInfo SecInfo `xml:"SECINFO"`
OptType String `xml:"OPTTYPE"` // One of PUT, CALL
OptType optType `xml:"OPTTYPE"` // One of PUT, CALL
StrikePrice Amount `xml:"STRIKEPRICE"`
DtExpire Date `xml:"DTEXPIRE"` // Expiration date
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
SecId *SecurityId `xml:"SECID,omitempty"` // Security ID of the underlying security
AssetClass String `xml:"ASSETCLASS,omitempty"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
AssetClass assetClass `xml:"ASSETCLASS,omitempty"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
}
@ -146,11 +146,11 @@ func (i OptInfo) SecurityType() string {
}
type OtherInfo struct {
XMLName xml.Name `xml:"OTHERINFO"`
SecInfo SecInfo `xml:"SECINFO"`
TypeDesc String `xml:"TYPEDESC,omitempty"` // Description of security type
AssetClass String `xml:"ASSETCLASS,omitempty"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
XMLName xml.Name `xml:"OTHERINFO"`
SecInfo SecInfo `xml:"SECINFO"`
TypeDesc String `xml:"TYPEDESC,omitempty"` // Description of security type
AssetClass assetClass `xml:"ASSETCLASS,omitempty"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
}
func (i OtherInfo) SecurityType() string {
@ -158,13 +158,13 @@ func (i OtherInfo) SecurityType() string {
}
type StockInfo struct {
XMLName xml.Name `xml:"STOCKINFO"`
SecInfo SecInfo `xml:"SECINFO"`
StockType String `xml:"STOCKTYPE,omitempty"` // One of COMMON, PREFERRED, CONVERTIBLE, OTHER
Yield Amount `xml:"YIELD,omitempty"` // Current yield reported as the dividend expressed as a portion of the current stock price
DtYieldAsOf *Date `xml:"DTYIELDASOF,omitempty"` // Date YIELD is valid for
AssetClass String `xml:"ASSETCLASS,omitempty"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
XMLName xml.Name `xml:"STOCKINFO"`
SecInfo SecInfo `xml:"SECINFO"`
StockType stockType `xml:"STOCKTYPE,omitempty"` // One of COMMON, PREFERRED, CONVERTIBLE, OTHER
Yield Amount `xml:"YIELD,omitempty"` // Current yield reported as the dividend expressed as a portion of the current stock price
DtYieldAsOf *Date `xml:"DTYIELDASOF,omitempty"` // Date YIELD is valid for
AssetClass assetClass `xml:"ASSETCLASS,omitempty"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
}
func (i StockInfo) SecurityType() string {

View File

@ -29,34 +29,34 @@ func (r *AcctInfoRequest) Type() messageType {
type HolderInfo struct {
XMLName xml.Name
FirstName String `xml:"FIRSTNAME"`
MiddleName String `xml:"MIDDLENAME,omitempty"`
LastName String `xml:"LASTNAME"`
Addr1 String `xml:"ADDR1"`
Addr2 String `xml:"ADDR2,omitempty"`
Addr3 String `xml:"ADDR3,omitempty"`
City String `xml:"CITY"`
State String `xml:"STATE"`
PostalCode String `xml:"POSTALCODE"`
Country String `xml:"COUNTRY,omitempty"`
DayPhone String `xml:"DAYPHONE,omitempty"`
EvePhone String `xml:"EVEPHONE,omitempty"`
Email String `xml:"EMAIL,omitempty"`
HolderType String `xml:"HOLDERTYPE,omitempty"` // One of INDIVIDUAL, JOINT, CUSTODIAL, TRUST, OTHER
FirstName String `xml:"FIRSTNAME"`
MiddleName String `xml:"MIDDLENAME,omitempty"`
LastName String `xml:"LASTNAME"`
Addr1 String `xml:"ADDR1"`
Addr2 String `xml:"ADDR2,omitempty"`
Addr3 String `xml:"ADDR3,omitempty"`
City String `xml:"CITY"`
State String `xml:"STATE"`
PostalCode String `xml:"POSTALCODE"`
Country String `xml:"COUNTRY,omitempty"`
DayPhone String `xml:"DAYPHONE,omitempty"`
EvePhone String `xml:"EVEPHONE,omitempty"`
Email String `xml:"EMAIL,omitempty"`
HolderType holderType `xml:"HOLDERTYPE,omitempty"` // One of INDIVIDUAL, JOINT, CUSTODIAL, TRUST, OTHER
}
type BankAcctInfo struct {
XMLName xml.Name `xml:"BANKACCTINFO"`
BankAcctFrom BankAcct `xml:"BANKACCTFROM"`
SupTxDl Boolean `xml:"SUPTXDL"` // Supports downloading transactions (as opposed to balance only)
XferSrc Boolean `xml:"XFERSRC"` // Enabled as source for intra/interbank transfer
XferDest Boolean `xml:"XFERDEST"` // Enabled as destination for intra/interbank transfer
MaturityDate Date `xml:"MATURITYDATE,omitempty"` // Maturity date for CD, if CD
MaturityAmt Amount `xml:"MATURITYAMOUNT,omitempty"` // Maturity amount for CD, if CD
MinBalReq Amount `xml:"MINBALREQ,omitempty"` // Minimum balance required to avoid service fees
AcctClassification String `xml:"ACCTCLASSIFICATION,omitempty"` // One of PERSONAL, BUSINESS, CORPORATE, OTHER
OverdraftLimit Amount `xml:"OVERDRAFTLIMIT,omitempty"`
SvcStatus String `xml:"SVCSTATUS"` // One of AVAIL (available, but not yet requested), PEND (requested, but not yet available), ACTIVE
XMLName xml.Name `xml:"BANKACCTINFO"`
BankAcctFrom BankAcct `xml:"BANKACCTFROM"`
SupTxDl Boolean `xml:"SUPTXDL"` // Supports downloading transactions (as opposed to balance only)
XferSrc Boolean `xml:"XFERSRC"` // Enabled as source for intra/interbank transfer
XferDest Boolean `xml:"XFERDEST"` // Enabled as destination for intra/interbank transfer
MaturityDate Date `xml:"MATURITYDATE,omitempty"` // Maturity date for CD, if CD
MaturityAmt Amount `xml:"MATURITYAMOUNT,omitempty"` // Maturity amount for CD, if CD
MinBalReq Amount `xml:"MINBALREQ,omitempty"` // Minimum balance required to avoid service fees
AcctClassification acctClassification `xml:"ACCTCLASSIFICATION,omitempty"` // One of PERSONAL, BUSINESS, CORPORATE, OTHER
OverdraftLimit Amount `xml:"OVERDRAFTLIMIT,omitempty"`
SvcStatus svcStatus `xml:"SVCSTATUS"` // One of AVAIL (available, but not yet requested), PEND (requested, but not yet available), ACTIVE
}
// Make pointers to these structs print nicely
@ -65,13 +65,13 @@ func (bai *BankAcctInfo) String() string {
}
type CCAcctInfo struct {
XMLName xml.Name `xml:"CCACCTINFO"`
CCAcctFrom CCAcct `xml:"CCACCTFROM"`
SupTxDl Boolean `xml:"SUPTXDL"` // Supports downloading transactions (as opposed to balance only)
XferSrc Boolean `xml:"XFERSRC"` // Enabled as source for intra/interbank transfer
XferDest Boolean `xml:"XFERDEST"` // Enabled as destination for intra/interbank transfer
AcctClassification String `xml:"ACCTCLASSIFICATION,omitempty"` // One of PERSONAL, BUSINESS, CORPORATE, OTHER
SvcStatus String `xml:"SVCSTATUS"` // One of AVAIL (available, but not yet requested), PEND (requested, but not yet available), ACTIVE
XMLName xml.Name `xml:"CCACCTINFO"`
CCAcctFrom CCAcct `xml:"CCACCTFROM"`
SupTxDl Boolean `xml:"SUPTXDL"` // Supports downloading transactions (as opposed to balance only)
XferSrc Boolean `xml:"XFERSRC"` // Enabled as source for intra/interbank transfer
XferDest Boolean `xml:"XFERDEST"` // Enabled as destination for intra/interbank transfer
AcctClassification acctClassification `xml:"ACCTCLASSIFICATION,omitempty"` // One of PERSONAL, BUSINESS, CORPORATE, OTHER
SvcStatus svcStatus `xml:"SVCSTATUS"` // One of AVAIL (available, but not yet requested), PEND (requested, but not yet available), ACTIVE
}
// Make pointers to these structs print nicely
@ -80,13 +80,13 @@ func (ci *CCAcctInfo) String() string {
}
type InvAcctInfo struct {
XMLName xml.Name `xml:"INVACCTINFO"`
InvAcctFrom InvAcct `xml:"INVACCTFROM"`
UsProductType String `xml:"USPRODUCTTYPE"` // One of 401K, 403B, IRA, KEOGH, OTHER, SARSEP, SIMPLE, NORMAL, TDA, TRUST, UGMA
Checking Boolean `xml:"CHECKING"` // Has check-writing privileges
SvcStatus String `xml:"SVCSTATUS"` // One of AVAIL (available, but not yet requested), PEND (requested, but not yet available), ACTIVE
InvAcctType String `xml:"INVACCTTYPE,omitempty"` // One of INDIVIDUAL, JOINT, TRUST, CORPORATE
OptionLevel String `xml:"OPTIONLEVEL,omitempty"` // Text desribing option trading privileges
XMLName xml.Name `xml:"INVACCTINFO"`
InvAcctFrom InvAcct `xml:"INVACCTFROM"`
UsProductType usProductType `xml:"USPRODUCTTYPE"` // One of 401K, 403B, IRA, KEOGH, OTHER, SARSEP, SIMPLE, NORMAL, TDA, TRUST, UGMA
Checking Boolean `xml:"CHECKING"` // Has check-writing privileges
SvcStatus svcStatus `xml:"SVCSTATUS"` // One of AVAIL (available, but not yet requested), PEND (requested, but not yet available), ACTIVE
InvAcctType acctClassification `xml:"INVACCTTYPE,omitempty"` // One of INDIVIDUAL, JOINT, TRUST, CORPORATE
OptionLevel String `xml:"OPTIONLEVEL,omitempty"` // Text desribing option trading privileges
}
// Make pointers to these structs print nicely

View File

@ -126,12 +126,12 @@ func TestUnmarshalAcctInfoResponse(t *testing.T) {
BankAcctFrom: ofxgo.BankAcct{
BankId: "8367556009",
AcctId: "000999847",
AcctType: "MONEYMRKT",
AcctType: ofxgo.AcctTypeMoneyMrkt,
},
SupTxDl: true,
XferSrc: true,
XferDest: true,
SvcStatus: "ACTIVE",
SvcStatus: ofxgo.SvcStatusActive,
}
acctInfoResponse := ofxgo.AcctInfoResponse{