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:
parent
ea700b33a9
commit
4521bb377a
68
bank.go
68
bank.go
@ -45,43 +45,43 @@ type Payee struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ImageData struct {
|
type ImageData struct {
|
||||||
XMLName xml.Name `xml:"IMAGEDATA"`
|
XMLName xml.Name `xml:"IMAGEDATA"`
|
||||||
ImageType String `xml:"IMAGETYPE"` // One of STATEMENT, TRANSACTION, TAX
|
ImageType imageType `xml:"IMAGETYPE"` // One of STATEMENT, TRANSACTION, TAX
|
||||||
ImageRef String `xml:"IMAGEREF"` // URL or identifier, depending on IMAGEREFTYPE
|
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)
|
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
|
// 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
|
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
|
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
|
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
|
CheckSup checkSup `xml:"CHECKSUP,omitempty"` // What is contained in check images. One of FRONTONLY, BACKONLY, FRONTANDBACK
|
||||||
}
|
}
|
||||||
|
|
||||||
type Transaction struct {
|
type Transaction struct {
|
||||||
XMLName xml.Name `xml:"STMTTRN"`
|
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
|
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"`
|
DtPosted Date `xml:"DTPOSTED"`
|
||||||
DtUser *Date `xml:"DTUSER,omitempty"`
|
DtUser *Date `xml:"DTUSER,omitempty"`
|
||||||
DtAvail *Date `xml:"DTAVAIL,omitempty"`
|
DtAvail *Date `xml:"DTAVAIL,omitempty"`
|
||||||
TrnAmt Amount `xml:"TRNAMT"`
|
TrnAmt Amount `xml:"TRNAMT"`
|
||||||
FiTId String `xml:"FITID"`
|
FiTId String `xml:"FITID"`
|
||||||
CorrectFiTId String `xml:"CORRECTFITID,omitempty"` // Transaction Id that this transaction corrects, if present
|
CorrectFiTId String `xml:"CORRECTFITID,omitempty"` // Transaction Id that this transaction corrects, if present
|
||||||
CorrectAction String `xml:"CORRECTACTION,omitempty"` // One of DELETE, REPLACE
|
CorrectAction correctAction `xml:"CORRECTACTION,omitempty"` // One of DELETE, REPLACE
|
||||||
SrvrTId String `xml:"SRVRTID,omitempty"`
|
SrvrTId String `xml:"SRVRTID,omitempty"`
|
||||||
CheckNum String `xml:"CHECKNUM,omitempty"`
|
CheckNum String `xml:"CHECKNUM,omitempty"`
|
||||||
RefNum String `xml:"REFNUM,omitempty"`
|
RefNum String `xml:"REFNUM,omitempty"`
|
||||||
SIC Int `xml:"SIC,omitempty"` // Standard Industrial Code
|
SIC Int `xml:"SIC,omitempty"` // Standard Industrial Code
|
||||||
PayeeId String `xml:"PAYEEID,omitempty"`
|
PayeeId String `xml:"PAYEEID,omitempty"`
|
||||||
// Note: Servers should provide NAME or PAYEE, but not both
|
// Note: Servers should provide NAME or PAYEE, but not both
|
||||||
Name String `xml:"NAME,omitempty"`
|
Name String `xml:"NAME,omitempty"`
|
||||||
Payee *Payee `xml:"PAYEE,omitempty"`
|
Payee *Payee `xml:"PAYEE,omitempty"`
|
||||||
ExtdName String `xml:"EXTDNAME,omitempty"` // Extended name of payee or transaction description
|
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
|
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
|
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)
|
Memo String `xml:"MEMO,omitempty"` // Extra information (not in NAME)
|
||||||
ImageData []ImageData `xml:"IMAGEDATA,omitempty"`
|
ImageData []ImageData `xml:"IMAGEDATA,omitempty"`
|
||||||
Currency String `xml:"CURRENCY,omitempty"` // If different from CURDEF in STMTTRS
|
Currency String `xml:"CURRENCY,omitempty"` // If different from CURDEF in STMTTRS
|
||||||
OrigCurrency String `xml:"ORIGCURRENCY,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.)
|
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 {
|
type TransactionList struct {
|
||||||
@ -93,7 +93,7 @@ type TransactionList struct {
|
|||||||
|
|
||||||
type PendingTransaction struct {
|
type PendingTransaction struct {
|
||||||
XMLName xml.Name `xml:"STMTTRN"`
|
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"`
|
DtTran Date `xml:"DTTRAN"`
|
||||||
DtExpire *Date `xml:"DTEXPIRE,omitempty"` // only valid for TrnType==HOLD, the date the hold will expire
|
DtExpire *Date `xml:"DTEXPIRE,omitempty"` // only valid for TrnType==HOLD, the date the hold will expire
|
||||||
TrnAmt Amount `xml:"TRNAMT"`
|
TrnAmt Amount `xml:"TRNAMT"`
|
||||||
@ -122,7 +122,7 @@ type Balance struct {
|
|||||||
// DOLLAR = dollar (value formatted DDDD.cc)
|
// DOLLAR = dollar (value formatted DDDD.cc)
|
||||||
// PERCENT = percentage (value formatted XXXX.YYYY)
|
// PERCENT = percentage (value formatted XXXX.YYYY)
|
||||||
// NUMBER = number (value formatted as is)
|
// NUMBER = number (value formatted as is)
|
||||||
BalType String `xml:"BALTYPE"`
|
BalType balType `xml:"BALTYPE"`
|
||||||
|
|
||||||
Value Amount `xml:"VALUE"`
|
Value Amount `xml:"VALUE"`
|
||||||
DtAsOf *Date `xml:"DTASOF,omitempty"`
|
DtAsOf *Date `xml:"DTASOF,omitempty"`
|
||||||
|
@ -59,7 +59,7 @@ func TestMarshalBankStatementRequest(t *testing.T) {
|
|||||||
BankAcctFrom: ofxgo.BankAcct{
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
BankId: "318398732",
|
BankId: "318398732",
|
||||||
AcctId: "78346129",
|
AcctId: "78346129",
|
||||||
AcctType: "CHECKING",
|
AcctType: ofxgo.AcctTypeChecking,
|
||||||
},
|
},
|
||||||
Include: true,
|
Include: true,
|
||||||
}
|
}
|
||||||
@ -158,14 +158,14 @@ func TestUnmarshalBankStatementResponse(t *testing.T) {
|
|||||||
DtEnd: *ofxgo.NewDateGMT(2006, 1, 15, 0, 0, 0, 0),
|
DtEnd: *ofxgo.NewDateGMT(2006, 1, 15, 0, 0, 0, 0),
|
||||||
Transactions: []ofxgo.Transaction{
|
Transactions: []ofxgo.Transaction{
|
||||||
{
|
{
|
||||||
TrnType: "CHECK",
|
TrnType: ofxgo.TrnTypeCheck,
|
||||||
DtPosted: *ofxgo.NewDateGMT(2006, 1, 4, 0, 0, 0, 0),
|
DtPosted: *ofxgo.NewDateGMT(2006, 1, 4, 0, 0, 0, 0),
|
||||||
TrnAmt: trnamt1,
|
TrnAmt: trnamt1,
|
||||||
FiTId: "00592",
|
FiTId: "00592",
|
||||||
CheckNum: "2002",
|
CheckNum: "2002",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
TrnType: "ATM",
|
TrnType: ofxgo.TrnTypeATM,
|
||||||
DtPosted: *ofxgo.NewDateGMT(2006, 1, 12, 0, 0, 0, 0),
|
DtPosted: *ofxgo.NewDateGMT(2006, 1, 12, 0, 0, 0, 0),
|
||||||
DtUser: ofxgo.NewDateGMT(2006, 1, 12, 0, 0, 0, 0),
|
DtUser: ofxgo.NewDateGMT(2006, 1, 12, 0, 0, 0, 0),
|
||||||
TrnAmt: trnamt2,
|
TrnAmt: trnamt2,
|
||||||
@ -188,7 +188,7 @@ func TestUnmarshalBankStatementResponse(t *testing.T) {
|
|||||||
BankAcctFrom: ofxgo.BankAcct{
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
BankId: "318398732",
|
BankId: "318398732",
|
||||||
AcctId: "78346129",
|
AcctId: "78346129",
|
||||||
AcctType: "CHECKING",
|
AcctType: ofxgo.AcctTypeChecking,
|
||||||
},
|
},
|
||||||
BankTranList: &banktranlist,
|
BankTranList: &banktranlist,
|
||||||
BalAmt: balamt,
|
BalAmt: balamt,
|
||||||
|
@ -40,6 +40,12 @@ func downloadCheckFlags() bool {
|
|||||||
func download() {
|
func download() {
|
||||||
client, query := NewRequest()
|
client, query := NewRequest()
|
||||||
|
|
||||||
|
acctTypeEnum, err := ofxgo.NewAcctType(acctType)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Error parsing accttype:", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
uid, err := ofxgo.RandomUID()
|
uid, err := ofxgo.RandomUID()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error creating uid for transaction:", err)
|
fmt.Println("Error creating uid for transaction:", err)
|
||||||
@ -51,10 +57,11 @@ func download() {
|
|||||||
BankAcctFrom: ofxgo.BankAcct{
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
BankId: ofxgo.String(bankId),
|
BankId: ofxgo.String(bankId),
|
||||||
AcctId: ofxgo.String(acctId),
|
AcctId: ofxgo.String(acctId),
|
||||||
AcctType: ofxgo.String(acctType),
|
AcctType: acctTypeEnum,
|
||||||
},
|
},
|
||||||
Include: true,
|
Include: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
query.Bank = append(query.Bank, &statementRequest)
|
query.Bank = append(query.Bank, &statementRequest)
|
||||||
|
|
||||||
response, err := client.RequestNoParse(query)
|
response, err := client.RequestNoParse(query)
|
||||||
|
@ -25,6 +25,12 @@ func init() {
|
|||||||
func bankTransactions() {
|
func bankTransactions() {
|
||||||
client, query := NewRequest()
|
client, query := NewRequest()
|
||||||
|
|
||||||
|
acctTypeEnum, err := ofxgo.NewAcctType(acctType)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Error parsing accttype:", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
uid, err := ofxgo.RandomUID()
|
uid, err := ofxgo.RandomUID()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error creating uid for transaction:", err)
|
fmt.Println("Error creating uid for transaction:", err)
|
||||||
@ -36,10 +42,11 @@ func bankTransactions() {
|
|||||||
BankAcctFrom: ofxgo.BankAcct{
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
BankId: ofxgo.String(bankId),
|
BankId: ofxgo.String(bankId),
|
||||||
AcctId: ofxgo.String(acctId),
|
AcctId: ofxgo.String(acctId),
|
||||||
AcctType: ofxgo.String(acctType),
|
AcctType: acctTypeEnum,
|
||||||
},
|
},
|
||||||
Include: true,
|
Include: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
query.Bank = append(query.Bank, &statementRequest)
|
query.Bank = append(query.Bank, &statementRequest)
|
||||||
|
|
||||||
response, err := client.Request(query)
|
response, err := client.Request(query)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package ofxgo
|
package ofxgo
|
||||||
|
|
||||||
|
//go:generate ./generate_constants.py
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/aclindsa/go/src/encoding/xml"
|
"github.com/aclindsa/go/src/encoding/xml"
|
||||||
@ -261,7 +263,7 @@ type BankAcct struct {
|
|||||||
BankId String `xml:"BANKID"`
|
BankId String `xml:"BANKID"`
|
||||||
BranchId String `xml:"BRANCHID,omitempty"` // Unused in USA
|
BranchId String `xml:"BRANCHID,omitempty"` // Unused in USA
|
||||||
AcctId String `xml:"ACCTID"`
|
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
|
AcctKey String `xml:"ACCTKEY,omitempty"` // Unused in USA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2473
constants.go
Normal file
2473
constants.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -105,21 +105,21 @@ NEWFILEUID:NONE
|
|||||||
DtEnd: *ofxgo.NewDate(2017, 3, 31, 15, 46, 48, 688000000, EDT),
|
DtEnd: *ofxgo.NewDate(2017, 3, 31, 15, 46, 48, 688000000, EDT),
|
||||||
Transactions: []ofxgo.Transaction{
|
Transactions: []ofxgo.Transaction{
|
||||||
{
|
{
|
||||||
TrnType: "DEBIT",
|
TrnType: ofxgo.TrnTypeDebit,
|
||||||
DtPosted: *ofxgo.NewDateGMT(2017, 2, 9, 12, 0, 0, 0),
|
DtPosted: *ofxgo.NewDateGMT(2017, 2, 9, 12, 0, 0, 0),
|
||||||
TrnAmt: trnamt1,
|
TrnAmt: trnamt1,
|
||||||
FiTId: "2017020924435657040207171600195",
|
FiTId: "2017020924435657040207171600195",
|
||||||
Name: "SLICE OF NY",
|
Name: "SLICE OF NY",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
TrnType: "CREDIT",
|
TrnType: ofxgo.TrnTypeCredit,
|
||||||
DtPosted: *ofxgo.NewDateGMT(2016, 12, 28, 12, 0, 0, 0),
|
DtPosted: *ofxgo.NewDateGMT(2016, 12, 28, 12, 0, 0, 0),
|
||||||
TrnAmt: trnamt2,
|
TrnAmt: trnamt2,
|
||||||
FiTId: "2016122823633637200000258482730",
|
FiTId: "2016122823633637200000258482730",
|
||||||
Name: "Payment Thank You Electro",
|
Name: "Payment Thank You Electro",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
TrnType: "DEBIT",
|
TrnType: ofxgo.TrnTypeDebit,
|
||||||
DtPosted: *ofxgo.NewDateGMT(2017, 3, 27, 12, 0, 0, 0),
|
DtPosted: *ofxgo.NewDateGMT(2017, 3, 27, 12, 0, 0, 0),
|
||||||
TrnAmt: trnamt3,
|
TrnAmt: trnamt3,
|
||||||
FiTId: "2017032724445727085300442885680",
|
FiTId: "2017032724445727085300442885680",
|
||||||
|
155
generate_constants.py
Executable file
155
generate_constants.py
Executable 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))
|
428
invstmt.go
428
invstmt.go
@ -48,57 +48,57 @@ type InvTran struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type InvBuy struct {
|
type InvBuy struct {
|
||||||
XMLName xml.Name `xml:"INVBUY"`
|
XMLName xml.Name `xml:"INVBUY"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
SecId SecurityId `xml:"SECID"`
|
||||||
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
|
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
|
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
|
Markup Amount `xml:"MARKUP,omitempty"` // Portion of UNITPRICE that is attributed to the dealer markup
|
||||||
Commission Amount `xml:"COMMISSION,omitempty"`
|
Commission Amount `xml:"COMMISSION,omitempty"`
|
||||||
Taxes Amount `xml:"TAXES,omitempty"`
|
Taxes Amount `xml:"TAXES,omitempty"`
|
||||||
Fees Amount `xml:"FEES,omitempty"`
|
Fees Amount `xml:"FEES,omitempty"`
|
||||||
Load Amount `xml:"LOAD,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
|
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
|
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
||||||
OrigCurrency *Currency `xml:"ORIGCURRENCY,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
|
SubAcctSec subAcctType `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
|
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
|
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
|
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
|
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
|
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
|
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
|
PriorYearContrib Boolean `xml:"PRIORYEARCONTRIB,omitempty"` // For 401(k) accounts, indicates that this Buy was made with a prior year contribution
|
||||||
}
|
}
|
||||||
|
|
||||||
type InvSell struct {
|
type InvSell struct {
|
||||||
XMLName xml.Name `xml:"INVSELL"`
|
XMLName xml.Name `xml:"INVSELL"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
SecId SecurityId `xml:"SECID"`
|
||||||
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
|
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
|
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
|
Markdown Amount `xml:"MARKDOWN,omitempty"` // Portion of UNITPRICE that is attributed to the dealer markdown
|
||||||
Commission Amount `xml:"COMMISSION,omitempty"`
|
Commission Amount `xml:"COMMISSION,omitempty"`
|
||||||
Taxes Amount `xml:"TAXES,omitempty"`
|
Taxes Amount `xml:"TAXES,omitempty"`
|
||||||
Fees Amount `xml:"FEES,omitempty"`
|
Fees Amount `xml:"FEES,omitempty"`
|
||||||
Load Amount `xml:"LOAD,omitempty"`
|
Load Amount `xml:"LOAD,omitempty"`
|
||||||
Witholding Amount `xml:"WITHHOLDING,omitempty"` // Federal tax witholdings
|
Witholding Amount `xml:"WITHHOLDING,omitempty"` // Federal tax witholdings
|
||||||
TaxExempt Boolean `xml:"TAXEXEMPT,omitempty"` // Tax-exempt transaction
|
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
|
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
|
Gain Amount `xml:"GAIN,omitempty"` // Total gain
|
||||||
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
||||||
OrigCurrency *Currency `xml:"ORIGCURRENCY,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
|
SubAcctSec subAcctType `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
|
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
|
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
|
StateWitholding Amount `xml:"STATEWITHHOLDING,omitempty"` // State tax witholdings
|
||||||
Penalty Amount `xml:"PENALTY,omitempty"` // Amount witheld due to penalty
|
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 {
|
type BuyDebt struct {
|
||||||
@ -114,7 +114,7 @@ func (t BuyDebt) TransactionType() string {
|
|||||||
type BuyMF struct {
|
type BuyMF struct {
|
||||||
XMLName xml.Name `xml:"BUYMF"`
|
XMLName xml.Name `xml:"BUYMF"`
|
||||||
InvBuy InvBuy `xml:"INVBUY"`
|
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
|
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 {
|
type BuyOpt struct {
|
||||||
XMLName xml.Name `xml:"BUYOPT"`
|
XMLName xml.Name `xml:"BUYOPT"`
|
||||||
InvBuy InvBuy `xml:"INVBUY"`
|
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.)
|
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
|
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t BuyOpt) TransactionType() string {
|
func (t BuyOpt) TransactionType() string {
|
||||||
@ -145,7 +145,7 @@ func (t BuyOther) TransactionType() string {
|
|||||||
type BuyStock struct {
|
type BuyStock struct {
|
||||||
XMLName xml.Name `xml:"BUYSTOCK"`
|
XMLName xml.Name `xml:"BUYSTOCK"`
|
||||||
InvBuy InvBuy `xml:"INVBUY"`
|
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 {
|
func (t BuyStock) TransactionType() string {
|
||||||
@ -153,15 +153,15 @@ func (t BuyStock) TransactionType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ClosureOpt struct {
|
type ClosureOpt struct {
|
||||||
XMLName xml.Name `xml:"CLOSUREOPT"`
|
XMLName xml.Name `xml:"CLOSUREOPT"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
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 option’s expired date is reached
|
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 option’s expired date is reached
|
||||||
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
|
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
|
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
|
||||||
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
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
|
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
|
||||||
Gain Amount `xml:"GAIN,omitempty"` // Total gain
|
Gain Amount `xml:"GAIN,omitempty"` // Total gain
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t ClosureOpt) TransactionType() string {
|
func (t ClosureOpt) TransactionType() string {
|
||||||
@ -170,18 +170,18 @@ func (t ClosureOpt) TransactionType() string {
|
|||||||
|
|
||||||
// Investment income is realized as cash into the investment account
|
// Investment income is realized as cash into the investment account
|
||||||
type Income struct {
|
type Income struct {
|
||||||
XMLName xml.Name `xml:"INCOME"`
|
XMLName xml.Name `xml:"INCOME"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
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
|
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"`
|
Total Amount `xml:"TOTAL"`
|
||||||
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
SubAcctSec subAcctType `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
|
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
|
TaxExempt Boolean `xml:"TAXEXEMPT,omitempty"` // Tax-exempt transaction
|
||||||
Witholding Amount `xml:"WITHHOLDING,omitempty"` // Federal tax witholdings
|
Witholding Amount `xml:"WITHHOLDING,omitempty"` // Federal tax witholdings
|
||||||
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
||||||
OrigCurrency *Currency `xml:"ORIGCURRENCY,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
|
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 {
|
func (t Income) TransactionType() string {
|
||||||
@ -190,15 +190,15 @@ func (t Income) TransactionType() string {
|
|||||||
|
|
||||||
// Expense associated with an investment
|
// Expense associated with an investment
|
||||||
type InvExpense struct {
|
type InvExpense struct {
|
||||||
XMLName xml.Name `xml:"INVEXPENSE"`
|
XMLName xml.Name `xml:"INVEXPENSE"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
SecId SecurityId `xml:"SECID"`
|
||||||
Total Amount `xml:"TOTAL"`
|
Total Amount `xml:"TOTAL"`
|
||||||
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
SubAcctSec subAcctType `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
|
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
|
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
||||||
OrigCurrency *Currency `xml:"ORIGCURRENCY,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
|
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 {
|
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.
|
// Journaling cash holdings between sub-accounts within the same investment account.
|
||||||
type JrnlFund struct {
|
type JrnlFund struct {
|
||||||
XMLName xml.Name `xml:"JRNLFUND"`
|
XMLName xml.Name `xml:"JRNLFUND"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
Total Amount `xml:"TOTAL"`
|
Total Amount `xml:"TOTAL"`
|
||||||
SubAcctFrom String `xml:"SUBACCTFROM"` // Sub-account cash is being transferred from: CASH, MARGIN, SHORT, OTHER
|
SubAcctFrom subAcctType `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
|
SubAcctTo subAcctType `xml:"SUBACCTTO"` // Sub-account cash is being transferred to: CASH, MARGIN, SHORT, OTHER
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t JrnlFund) TransactionType() string {
|
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.
|
// Journaling security holdings between sub-accounts within the same investment account.
|
||||||
type JrnlSec struct {
|
type JrnlSec struct {
|
||||||
XMLName xml.Name `xml:"JRNLSEC"`
|
XMLName xml.Name `xml:"JRNLSEC"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
SecId SecurityId `xml:"SECID"`
|
||||||
SubAcctFrom String `xml:"SUBACCTFROM"` // Sub-account cash is being transferred from: CASH, MARGIN, SHORT, OTHER
|
SubAcctFrom subAcctType `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
|
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
|
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t JrnlSec) TransactionType() string {
|
func (t JrnlSec) TransactionType() string {
|
||||||
@ -233,12 +233,12 @@ func (t JrnlSec) TransactionType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MarginInterest struct {
|
type MarginInterest struct {
|
||||||
XMLName xml.Name `xml:"MARGININTEREST"`
|
XMLName xml.Name `xml:"MARGININTEREST"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
Total Amount `xml:"TOTAL"`
|
Total Amount `xml:"TOTAL"`
|
||||||
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
|
||||||
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
||||||
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t MarginInterest) TransactionType() string {
|
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 can’t track this as a single transaction they should return an INCOME transaction and an INVTRAN.
|
// REINVEST is a single transaction that contains both income and an investment transaction. If servers can’t track this as a single transaction they should return an INCOME transaction and an INVTRAN.
|
||||||
type Reinvest struct {
|
type Reinvest struct {
|
||||||
XMLName xml.Name `xml:"REINVEST"`
|
XMLName xml.Name `xml:"REINVEST"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
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
|
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
|
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
|
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
|
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
|
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"`
|
Commission Amount `xml:"COMMISSION,omitempty"`
|
||||||
Taxes Amount `xml:"TAXES,omitempty"`
|
Taxes Amount `xml:"TAXES,omitempty"`
|
||||||
Fees Amount `xml:"FEES,omitempty"`
|
Fees Amount `xml:"FEES,omitempty"`
|
||||||
Load Amount `xml:"LOAD,omitempty"`
|
Load Amount `xml:"LOAD,omitempty"`
|
||||||
TaxExempt Boolean `xml:"TAXEXEMPT,omitempty"` // Tax-exempt transaction
|
TaxExempt Boolean `xml:"TAXEXEMPT,omitempty"` // Tax-exempt transaction
|
||||||
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
||||||
OrigCurrency *Currency `xml:"ORIGCURRENCY,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
|
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 {
|
func (t Reinvest) TransactionType() string {
|
||||||
@ -270,15 +270,15 @@ func (t Reinvest) TransactionType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RetOfCap struct {
|
type RetOfCap struct {
|
||||||
XMLName xml.Name `xml:"RETOFCAP"`
|
XMLName xml.Name `xml:"RETOFCAP"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
SecId SecurityId `xml:"SECID"`
|
||||||
Total Amount `xml:"TOTAL"`
|
Total Amount `xml:"TOTAL"`
|
||||||
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
SubAcctSec subAcctType `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
|
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
|
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
||||||
OrigCurrency *Currency `xml:"ORIGCURRENCY,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
|
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 {
|
func (t RetOfCap) TransactionType() string {
|
||||||
@ -286,10 +286,10 @@ func (t RetOfCap) TransactionType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SellDebt struct {
|
type SellDebt struct {
|
||||||
XMLName xml.Name `xml:"SELLDEBT"`
|
XMLName xml.Name `xml:"SELLDEBT"`
|
||||||
InvSell InvSell `xml:"INVSELL"`
|
InvSell InvSell `xml:"INVSELL"`
|
||||||
SellReason String `xml:"SELLREASON"` // CALL (the debt was called), SELL (the debt was sold), MATURITY (the debt reached maturity)
|
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
|
AccrdInt Amount `xml:"ACCRDINT,omitempty"` // Accrued interest
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t SellDebt) TransactionType() string {
|
func (t SellDebt) TransactionType() string {
|
||||||
@ -299,7 +299,7 @@ func (t SellDebt) TransactionType() string {
|
|||||||
type SellMF struct {
|
type SellMF struct {
|
||||||
XMLName xml.Name `xml:"SELLMF"`
|
XMLName xml.Name `xml:"SELLMF"`
|
||||||
InvSell InvSell `xml:"INVSELL"`
|
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"`
|
AvgCostBasis Amount `xml:"AVGCOSTBASIS"`
|
||||||
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
|
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 {
|
type SellOpt struct {
|
||||||
XMLName xml.Name `xml:"SELLOPT"`
|
XMLName xml.Name `xml:"SELLOPT"`
|
||||||
InvSell InvSell `xml:"INVSELL"`
|
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
|
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
|
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
|
||||||
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
|
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
|
RelType relType `xml:"RELTYPE,omitempty"` // Related option transaction type: SPREAD, STRADDLE, NONE, OTHER
|
||||||
Secured String `xml:"SECURED,omitempty"` // NAKED, COVERED
|
Secured secured `xml:"SECURED,omitempty"` // NAKED, COVERED
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t SellOpt) TransactionType() string {
|
func (t SellOpt) TransactionType() string {
|
||||||
@ -334,7 +334,7 @@ func (t SellOther) TransactionType() string {
|
|||||||
type SellStock struct {
|
type SellStock struct {
|
||||||
XMLName xml.Name `xml:"SELLSTOCK"`
|
XMLName xml.Name `xml:"SELLSTOCK"`
|
||||||
InvSell InvSell `xml:"INVSELL"`
|
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 {
|
func (t SellStock) TransactionType() string {
|
||||||
@ -342,19 +342,19 @@ func (t SellStock) TransactionType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Split struct {
|
type Split struct {
|
||||||
XMLName xml.Name `xml:"SPLIT"`
|
XMLName xml.Name `xml:"SPLIT"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
SecId SecurityId `xml:"SECID"`
|
||||||
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
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
|
OldUnits Amount `xml:"OLDUNITS"` // number of shares before the split
|
||||||
NewUnits Amount `xml:"NEWUNITS"` // number of shares after the split
|
NewUnits Amount `xml:"NEWUNITS"` // number of shares after the split
|
||||||
Numerator Int `xml:"NUMERATOR"` // split ratio numerator
|
Numerator Int `xml:"NUMERATOR"` // split ratio numerator
|
||||||
Denominator Int `xml:"DENOMINATOR"` // split ratio denominator
|
Denominator Int `xml:"DENOMINATOR"` // split ratio denominator
|
||||||
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
||||||
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
OrigCurrency *Currency `xml:"ORIGCURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
||||||
FracCash Amount `xml:"FRACCASH,omitempty"` // cash for fractional units
|
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
|
SubAcctFund subAcctType `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
|
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 {
|
func (t Split) TransactionType() string {
|
||||||
@ -362,18 +362,18 @@ func (t Split) TransactionType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Transfer struct {
|
type Transfer struct {
|
||||||
XMLName xml.Name `xml:"TRANSFER"`
|
XMLName xml.Name `xml:"TRANSFER"`
|
||||||
InvTran InvTran `xml:"INVTRAN"`
|
InvTran InvTran `xml:"INVTRAN"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
SecId SecurityId `xml:"SECID"`
|
||||||
SubAcctSec String `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
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
|
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
|
TferAction tferAction `xml:"TFERACTION"` // One of IN, OUT
|
||||||
PosType String `xml:"POSTYPE"` // Position type. One of LONG, SHORT
|
PosType posType `xml:"POSTYPE"` // Position type. One of LONG, SHORT
|
||||||
InvAcctFrom InvAcct `xml:"INVACCTFROM,omitempty"`
|
InvAcctFrom InvAcct `xml:"INVACCTFROM,omitempty"`
|
||||||
AvgCostBasis Amount `xml:"AVGCOSTBASIS,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
|
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"`
|
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
|
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 {
|
func (t Transfer) TransactionType() string {
|
||||||
@ -387,7 +387,7 @@ type InvTransaction interface {
|
|||||||
type InvBankTransaction struct {
|
type InvBankTransaction struct {
|
||||||
XMLName xml.Name `xml:"INVBANKTRAN"`
|
XMLName xml.Name `xml:"INVBANKTRAN"`
|
||||||
Transactions []Transaction `xml:"STMTTRN,omitempty"`
|
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
|
// 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 {
|
type InvPosition struct {
|
||||||
XMLName xml.Name `xml:"INVPOS"`
|
XMLName xml.Name `xml:"INVPOS"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
SecId SecurityId `xml:"SECID"`
|
||||||
HeldInAcct String `xml:"HELDINACCT"` // Sub-account type, one of CASH, MARGIN, SHORT, OTHER
|
HeldInAcct subAcctType `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.
|
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
|
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
|
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
|
MktVal Amount `xml:"MKTVAL"` // Market value of this position
|
||||||
AvgCostBasis Amount `xml:"AVGCOSTBASIS,omitempty"` //
|
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,
|
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
|
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
||||||
Memo String `xml:"MEMO,omitempty"`
|
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
|
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 {
|
type Position interface {
|
||||||
@ -600,7 +600,7 @@ func (p MFPosition) PositionType() string {
|
|||||||
type OptPosition struct {
|
type OptPosition struct {
|
||||||
XMLName xml.Name `xml:"POSOPT"`
|
XMLName xml.Name `xml:"POSOPT"`
|
||||||
InvPos InvPosition `xml:"INVPOS"`
|
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 {
|
func (p OptPosition) PositionType() string {
|
||||||
@ -689,21 +689,21 @@ type InvBalance struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OO struct {
|
type OO struct {
|
||||||
XMLName xml.Name `xml:"OO"`
|
XMLName xml.Name `xml:"OO"`
|
||||||
FiTId String `xml:"FITID"`
|
FiTId String `xml:"FITID"`
|
||||||
SrvrTId String `xml:"SRVRTID,omitempty"`
|
SrvrTId String `xml:"SRVRTID,omitempty"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
SecId SecurityId `xml:"SECID"`
|
||||||
DtPlaced Date `xml:"DTPLACED"` // Date the order was placed
|
DtPlaced Date `xml:"DTPLACED"` // Date the order was placed
|
||||||
Units Amount `xml:"UNITS"` // Quantity of the security the open order is for
|
Units Amount `xml:"UNITS"` // Quantity of the security the open order is for
|
||||||
SubAcct String `xml:"SUBACCT"` // One of CASH, MARGIN, SHORT, OTHER
|
SubAcct subAcctType `xml:"SUBACCT"` // One of CASH, MARGIN, SHORT, OTHER
|
||||||
Duration String `xml:"DURATION"` // How long the order is good for. One of DAY, GOODTILCANCEL, IMMEDIATE
|
Duration duration `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
|
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
|
MinUnits Amount `xml:"MINUNITS,omitempty"` // Minimum number of units that must be filled for the order
|
||||||
LimitPrice Amount `xml:"LIMITPRICE,omitempty"`
|
LimitPrice Amount `xml:"LIMITPRICE,omitempty"`
|
||||||
StopPrice Amount `xml:"STOPPRICE,omitempty"`
|
StopPrice Amount `xml:"STOPPRICE,omitempty"`
|
||||||
Memo String `xml:"MEMO,omitempty"`
|
Memo String `xml:"MEMO,omitempty"`
|
||||||
Currency *Currency `xml:"CURRENCY,omitempty"` // Overriding currency for UNITPRICE
|
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
|
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 {
|
type OpenOrder interface {
|
||||||
@ -724,8 +724,8 @@ func (o OOBuyDebt) OrderType() string {
|
|||||||
type OOBuyMF struct {
|
type OOBuyMF struct {
|
||||||
XMLName xml.Name `xml:"OOBUYMF"`
|
XMLName xml.Name `xml:"OOBUYMF"`
|
||||||
OO OO `xml:"OO"`
|
OO OO `xml:"OO"`
|
||||||
BuyType String `xml:"BUYTYPE"` // One of BUY, BUYTOCOVER
|
BuyType buyType `xml:"BUYTYPE"` // One of BUY, BUYTOCOVER
|
||||||
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 OOBuyMF) OrderType() string {
|
func (o OOBuyMF) OrderType() string {
|
||||||
@ -733,9 +733,9 @@ func (o OOBuyMF) OrderType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OOBuyOpt struct {
|
type OOBuyOpt struct {
|
||||||
XMLName xml.Name `xml:"OOBUYOPT"`
|
XMLName xml.Name `xml:"OOBUYOPT"`
|
||||||
OO OO `xml:"OO"`
|
OO OO `xml:"OO"`
|
||||||
OptBuyType String `xml:"OPTBUYTYPE"` // One of BUYTOOPEN, BUYTOCLOSE
|
OptBuyType optBuyType `xml:"OPTBUYTYPE"` // One of BUYTOOPEN, BUYTOCLOSE
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o OOBuyOpt) OrderType() string {
|
func (o OOBuyOpt) OrderType() string {
|
||||||
@ -745,7 +745,7 @@ func (o OOBuyOpt) OrderType() string {
|
|||||||
type OOBuyOther struct {
|
type OOBuyOther struct {
|
||||||
XMLName xml.Name `xml:"OOBUYOTHER"`
|
XMLName xml.Name `xml:"OOBUYOTHER"`
|
||||||
OO OO `xml:"OO"`
|
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 {
|
func (o OOBuyOther) OrderType() string {
|
||||||
@ -755,7 +755,7 @@ func (o OOBuyOther) OrderType() string {
|
|||||||
type OOBuyStock struct {
|
type OOBuyStock struct {
|
||||||
XMLName xml.Name `xml:"OOBUYSTOCK"`
|
XMLName xml.Name `xml:"OOBUYSTOCK"`
|
||||||
OO OO `xml:"OO"`
|
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 {
|
func (o OOBuyStock) OrderType() string {
|
||||||
@ -774,8 +774,8 @@ func (o OOSellDebt) OrderType() string {
|
|||||||
type OOSellMF struct {
|
type OOSellMF struct {
|
||||||
XMLName xml.Name `xml:"OOSELLMF"`
|
XMLName xml.Name `xml:"OOSELLMF"`
|
||||||
OO OO `xml:"OO"`
|
OO OO `xml:"OO"`
|
||||||
SellType String `xml:"SELLTYPE"` // One of SELL, SELLSHORT
|
SellType sellType `xml:"SELLTYPE"` // One of SELL, SELLSHORT
|
||||||
UnitType String `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
|
UnitType unitType `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
|
||||||
SellAll Boolean `xml:"SELLALL"` // Sell entire holding
|
SellAll Boolean `xml:"SELLALL"` // Sell entire holding
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,9 +784,9 @@ func (o OOSellMF) OrderType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OOSellOpt struct {
|
type OOSellOpt struct {
|
||||||
XMLName xml.Name `xml:"OOSELLOPT"`
|
XMLName xml.Name `xml:"OOSELLOPT"`
|
||||||
OO OO `xml:"OO"`
|
OO OO `xml:"OO"`
|
||||||
OptSellType String `xml:"OPTSELLTYPE"` // One of SELLTOOPEN, SELLTOCLOSE
|
OptSellType optSellType `xml:"OPTSELLTYPE"` // One of SELLTOOPEN, SELLTOCLOSE
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o OOSellOpt) OrderType() string {
|
func (o OOSellOpt) OrderType() string {
|
||||||
@ -796,7 +796,7 @@ func (o OOSellOpt) OrderType() string {
|
|||||||
type OOSellOther struct {
|
type OOSellOther struct {
|
||||||
XMLName xml.Name `xml:"OOSELLOTHER"`
|
XMLName xml.Name `xml:"OOSELLOTHER"`
|
||||||
OO OO `xml:"OO"`
|
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 {
|
func (o OOSellOther) OrderType() string {
|
||||||
@ -806,7 +806,7 @@ func (o OOSellOther) OrderType() string {
|
|||||||
type OOSellStock struct {
|
type OOSellStock struct {
|
||||||
XMLName xml.Name `xml:"OOSELLSTOCK"`
|
XMLName xml.Name `xml:"OOSELLSTOCK"`
|
||||||
OO OO `xml:"OO"`
|
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 {
|
func (o OOSellStock) OrderType() string {
|
||||||
@ -817,7 +817,7 @@ type OOSwitchMF struct {
|
|||||||
XMLName xml.Name `xml:"SWITCHMF"`
|
XMLName xml.Name `xml:"SWITCHMF"`
|
||||||
OO OO `xml:"OO"`
|
OO OO `xml:"OO"`
|
||||||
SecId SecurityId `xml:"SECID"` // Security ID of the fund to switch to or purchase
|
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
|
SwitchAll Boolean `xml:"SWITCHALL"` // Switch entire holding
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -938,22 +938,22 @@ type VestInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type LoanInfo struct {
|
type LoanInfo struct {
|
||||||
XMLName xml.Name `xml:"VESTINFO"`
|
XMLName xml.Name `xml:"VESTINFO"`
|
||||||
LoanID String `xml:"LOANID"` // Identifier of this loan
|
LoanID String `xml:"LOANID"` // Identifier of this loan
|
||||||
LoanDesc String `xml:"LOANDESC,omitempty"` // Loan description
|
LoanDesc String `xml:"LOANDESC,omitempty"` // Loan description
|
||||||
InitialLoanBal Amount `xml:"INITIALLOANBAL,omitempty"` // Initial loan balance
|
InitialLoanBal Amount `xml:"INITIALLOANBAL,omitempty"` // Initial loan balance
|
||||||
LoanStartDate *Date `xml:"LOANSTARTDATE,omitempty"` // Start date of loan
|
LoanStartDate *Date `xml:"LOANSTARTDATE,omitempty"` // Start date of loan
|
||||||
CurrentLoanBal Amount `xml:"CURRENTLOANBAL"` // Current loan principal balance
|
CurrentLoanBal Amount `xml:"CURRENTLOANBAL"` // Current loan principal balance
|
||||||
DtAsOf *Date `xml:"DTASOF"` // Date and time of the current loan balance
|
DtAsOf *Date `xml:"DTASOF"` // Date and time of the current loan balance
|
||||||
LoanRate Amount `xml:"LOANRATE,omitempty"` // Loan annual interest rate
|
LoanRate Amount `xml:"LOANRATE,omitempty"` // Loan annual interest rate
|
||||||
LoanPmtAmt Amount `xml:"LOANPMTAMT,omitempty"` // Loan payment amount
|
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.
|
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.
|
LoanPmtsInitial Int `xml:"LOANPMTSINITIAL,omitempty"` // Initial number of loan payments.
|
||||||
LoanPmtsRemaining Int `xml:"LOANPMTSREMAINING,omitempty"` // Remaining number of loan payments
|
LoanPmtsRemaining Int `xml:"LOANPMTSREMAINING,omitempty"` // Remaining number of loan payments
|
||||||
LoanMaturityDate *Date `xml:"LOANMATURITYDATE,omitempty"` // Expected loan end date
|
LoanMaturityDate *Date `xml:"LOANMATURITYDATE,omitempty"` // Expected loan end date
|
||||||
LoanTotalProjInterest Amount `xml:"LOANTOTALPROJINTEREST,omitempty"` // Total projected interest to be paid on this loan
|
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
|
LoanInterestToDate Amount `xml:"LOANINTERESTTODATE,omitempty"` // Total interested paid to date on this loan
|
||||||
LoanExtPmtDate *Date `xml:"LOANNEXTPMTDATE,omitempty"` // Next payment due date
|
LoanExtPmtDate *Date `xml:"LOANNEXTPMTDATE,omitempty"` // Next payment due date
|
||||||
}
|
}
|
||||||
|
|
||||||
type Inv401KSummaryAggregate struct {
|
type Inv401KSummaryAggregate struct {
|
||||||
|
@ -331,17 +331,17 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
UnitPrice: unitprice1,
|
UnitPrice: unitprice1,
|
||||||
Commission: commission1,
|
Commission: commission1,
|
||||||
Total: total1,
|
Total: total1,
|
||||||
SubAcctSec: "CASH",
|
SubAcctSec: ofxgo.SubAcctTypeCash,
|
||||||
SubAcctFund: "CASH",
|
SubAcctFund: ofxgo.SubAcctTypeCash,
|
||||||
},
|
},
|
||||||
BuyType: "BUY",
|
BuyType: ofxgo.BuyTypeBuy,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
BankTransactions: []ofxgo.InvBankTransaction{
|
BankTransactions: []ofxgo.InvBankTransaction{
|
||||||
ofxgo.InvBankTransaction{
|
ofxgo.InvBankTransaction{
|
||||||
Transactions: []ofxgo.Transaction{
|
Transactions: []ofxgo.Transaction{
|
||||||
ofxgo.Transaction{
|
ofxgo.Transaction{
|
||||||
TrnType: "CREDIT",
|
TrnType: ofxgo.TrnTypeCredit,
|
||||||
DtPosted: *ofxgo.NewDateGMT(2017, 1, 20, 0, 0, 0, 0),
|
DtPosted: *ofxgo.NewDateGMT(2017, 1, 20, 0, 0, 0, 0),
|
||||||
DtUser: ofxgo.NewDateGMT(2017, 1, 18, 0, 0, 0, 0),
|
DtUser: ofxgo.NewDateGMT(2017, 1, 18, 0, 0, 0, 0),
|
||||||
DtAvail: ofxgo.NewDateGMT(2017, 1, 23, 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",
|
Memo: "CHECK 19980",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
SubAcctFund: "CASH",
|
SubAcctFund: ofxgo.SubAcctTypeCash,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
ofxgo.Balance{
|
ofxgo.Balance{
|
||||||
Name: "Sweep Int Rate",
|
Name: "Sweep Int Rate",
|
||||||
Desc: "Current interest rate for sweep account balances",
|
Desc: "Current interest rate for sweep account balances",
|
||||||
BalType: "PERCENT",
|
BalType: ofxgo.BalTypePercent,
|
||||||
Value: balvalue,
|
Value: balvalue,
|
||||||
DtAsOf: ofxgo.NewDateGMT(2017, 4, 1, 0, 0, 0, 0),
|
DtAsOf: ofxgo.NewDateGMT(2017, 4, 1, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
@ -412,8 +412,8 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
UniqueId: "78462F103",
|
UniqueId: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIdType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: "CASH",
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: "LONG",
|
PosType: ofxgo.PosTypeLong,
|
||||||
Units: posunits1,
|
Units: posunits1,
|
||||||
UnitPrice: posunitprice1,
|
UnitPrice: posunitprice1,
|
||||||
MktVal: posmktval1,
|
MktVal: posmktval1,
|
||||||
@ -427,8 +427,8 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
UniqueId: "129887339",
|
UniqueId: "129887339",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIdType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: "CASH",
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: "LONG",
|
PosType: ofxgo.PosTypeLong,
|
||||||
Units: posunits2,
|
Units: posunits2,
|
||||||
UnitPrice: posunitprice2,
|
UnitPrice: posunitprice2,
|
||||||
MktVal: posmktval2,
|
MktVal: posmktval2,
|
||||||
@ -447,13 +447,13 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
|
||||||
Units: oounits1,
|
Units: oounits1,
|
||||||
SubAcct: "CASH",
|
SubAcct: ofxgo.SubAcctTypeCash,
|
||||||
Duration: "GOODTILCANCEL",
|
Duration: ofxgo.DurationGoodTilCancel,
|
||||||
Restriction: "NONE",
|
Restriction: ofxgo.RestrictionNone,
|
||||||
LimitPrice: oolimitprice1,
|
LimitPrice: oolimitprice1,
|
||||||
},
|
},
|
||||||
BuyType: "BUY",
|
BuyType: ofxgo.BuyTypeBuy,
|
||||||
UnitType: "SHARES",
|
UnitType: ofxgo.UnitTypeShares,
|
||||||
},
|
},
|
||||||
ofxgo.OOBuyStock{
|
ofxgo.OOBuyStock{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
@ -464,12 +464,12 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||||
Units: oounits2,
|
Units: oounits2,
|
||||||
SubAcct: "CASH",
|
SubAcct: ofxgo.SubAcctTypeCash,
|
||||||
Duration: "GOODTILCANCEL",
|
Duration: ofxgo.DurationGoodTilCancel,
|
||||||
Restriction: "ALLORNONE",
|
Restriction: ofxgo.RestrictionAllOrNone,
|
||||||
LimitPrice: oolimitprice2,
|
LimitPrice: oolimitprice2,
|
||||||
},
|
},
|
||||||
BuyType: "BUY",
|
BuyType: ofxgo.BuyTypeBuy,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -493,7 +493,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
FiId: "99184",
|
FiId: "99184",
|
||||||
},
|
},
|
||||||
Yield: yield1,
|
Yield: yield1,
|
||||||
AssetClass: "OTHER",
|
AssetClass: ofxgo.AssetClassOther,
|
||||||
},
|
},
|
||||||
ofxgo.OptInfo{
|
ofxgo.OptInfo{
|
||||||
SecInfo: ofxgo.SecInfo{
|
SecInfo: ofxgo.SecInfo{
|
||||||
@ -505,7 +505,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
Ticker: "FERTP",
|
Ticker: "FERTP",
|
||||||
FiId: "882919",
|
FiId: "882919",
|
||||||
},
|
},
|
||||||
OptType: "PUT",
|
OptType: ofxgo.OptTypePut,
|
||||||
StrikePrice: strikeprice,
|
StrikePrice: strikeprice,
|
||||||
DtExpire: *ofxgo.NewDateGMT(2017, 9, 1, 0, 0, 0, 0),
|
DtExpire: *ofxgo.NewDateGMT(2017, 9, 1, 0, 0, 0, 0),
|
||||||
ShPerCtrct: 100,
|
ShPerCtrct: 100,
|
||||||
@ -513,7 +513,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
UniqueId: "983322180",
|
UniqueId: "983322180",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIdType: "CUSIP",
|
||||||
},
|
},
|
||||||
AssetClass: "LARGESTOCK",
|
AssetClass: ofxgo.AssetClassLargeStock,
|
||||||
},
|
},
|
||||||
ofxgo.StockInfo{
|
ofxgo.StockInfo{
|
||||||
SecInfo: ofxgo.SecInfo{
|
SecInfo: ofxgo.SecInfo{
|
||||||
@ -526,7 +526,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
FiId: "883897",
|
FiId: "883897",
|
||||||
},
|
},
|
||||||
Yield: yield2,
|
Yield: yield2,
|
||||||
AssetClass: "SMALLSTOCK",
|
AssetClass: ofxgo.AssetClassSmallStock,
|
||||||
},
|
},
|
||||||
ofxgo.MFInfo{
|
ofxgo.MFInfo{
|
||||||
SecInfo: ofxgo.SecInfo{
|
SecInfo: ofxgo.SecInfo{
|
||||||
@ -754,10 +754,10 @@ NEWFILEUID: NONE
|
|||||||
Commission: commission1,
|
Commission: commission1,
|
||||||
Fees: fees1,
|
Fees: fees1,
|
||||||
Total: total1,
|
Total: total1,
|
||||||
SubAcctSec: "CASH",
|
SubAcctSec: ofxgo.SubAcctTypeCash,
|
||||||
SubAcctFund: "CASH",
|
SubAcctFund: ofxgo.SubAcctTypeCash,
|
||||||
},
|
},
|
||||||
OptSellType: "SELLTOOPEN",
|
OptSellType: ofxgo.OptSellTypeSellToOpen,
|
||||||
ShPerCtrct: 100,
|
ShPerCtrct: 100,
|
||||||
},
|
},
|
||||||
ofxgo.ClosureOpt{
|
ofxgo.ClosureOpt{
|
||||||
@ -770,10 +770,10 @@ NEWFILEUID: NONE
|
|||||||
UniqueId: "78462F10",
|
UniqueId: "78462F10",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIdType: "CUSIP",
|
||||||
},
|
},
|
||||||
OptAction: "ASSIGN",
|
OptAction: ofxgo.OptActionAssign,
|
||||||
Units: units2,
|
Units: units2,
|
||||||
ShPerCtrct: 100,
|
ShPerCtrct: 100,
|
||||||
SubAcctSec: "CASH",
|
SubAcctSec: ofxgo.SubAcctTypeCash,
|
||||||
},
|
},
|
||||||
ofxgo.ClosureOpt{
|
ofxgo.ClosureOpt{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
@ -785,10 +785,10 @@ NEWFILEUID: NONE
|
|||||||
UniqueId: "SPY161216C00226000",
|
UniqueId: "SPY161216C00226000",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIdType: "CUSIP",
|
||||||
},
|
},
|
||||||
OptAction: "ASSIGN",
|
OptAction: ofxgo.OptActionAssign,
|
||||||
Units: units3,
|
Units: units3,
|
||||||
ShPerCtrct: 100,
|
ShPerCtrct: 100,
|
||||||
SubAcctSec: "CASH",
|
SubAcctSec: ofxgo.SubAcctTypeCash,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -832,8 +832,8 @@ NEWFILEUID: NONE
|
|||||||
UniqueId: "04956010",
|
UniqueId: "04956010",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIdType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: "CASH",
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: "LONG",
|
PosType: ofxgo.PosTypeLong,
|
||||||
Units: posunits1,
|
Units: posunits1,
|
||||||
UnitPrice: posunitprice1,
|
UnitPrice: posunitprice1,
|
||||||
MktVal: posmktval1,
|
MktVal: posmktval1,
|
||||||
@ -846,8 +846,8 @@ NEWFILEUID: NONE
|
|||||||
UniqueId: "36960410",
|
UniqueId: "36960410",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIdType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: "CASH",
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: "LONG",
|
PosType: ofxgo.PosTypeLong,
|
||||||
Units: posunits2,
|
Units: posunits2,
|
||||||
UnitPrice: posunitprice2,
|
UnitPrice: posunitprice2,
|
||||||
MktVal: posmktval2,
|
MktVal: posmktval2,
|
||||||
@ -883,7 +883,7 @@ NEWFILEUID: NONE
|
|||||||
SecName: "SPY Dec 16 2016 226.00 Call",
|
SecName: "SPY Dec 16 2016 226.00 Call",
|
||||||
Ticker: "SPY 161216C00226000",
|
Ticker: "SPY 161216C00226000",
|
||||||
},
|
},
|
||||||
OptType: "CALL",
|
OptType: ofxgo.OptTypeCall,
|
||||||
StrikePrice: strikeprice,
|
StrikePrice: strikeprice,
|
||||||
DtExpire: *ofxgo.NewDateGMT(2016, 12, 16, 12, 0, 0, 0),
|
DtExpire: *ofxgo.NewDateGMT(2016, 12, 16, 12, 0, 0, 0),
|
||||||
ShPerCtrct: 100,
|
ShPerCtrct: 100,
|
||||||
|
@ -34,7 +34,7 @@ type SignonInfo struct {
|
|||||||
SignonRealm String `xml:"SIGNONREALM"`
|
SignonRealm String `xml:"SIGNONREALM"`
|
||||||
Min Int `xml:"MIN"` // Minimum number of password characters
|
Min Int `xml:"MIN"` // Minimum number of password characters
|
||||||
Max Int `xml:"MAX"` // Maximum 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?
|
CaseSen Boolean `xml:"CASESEN"` // Password is case-sensitive?
|
||||||
Special Boolean `xml:"SPECIAL"` // Special characters allowed?
|
Special Boolean `xml:"SPECIAL"` // Special characters allowed?
|
||||||
Spaces Boolean `xml:"SPACES"` // Spaces allowed?
|
Spaces Boolean `xml:"SPACES"` // Spaces allowed?
|
||||||
@ -56,11 +56,11 @@ type MessageSet struct {
|
|||||||
Name string // <xxxMSGSETVn> (copy of XMLName.Local)
|
Name string // <xxxMSGSETVn> (copy of XMLName.Local)
|
||||||
Ver Int `xml:"MSGSETCORE>VER"` // Message set version - should always match 'n' in <xxxMSGSETVn>
|
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
|
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
|
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
|
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
|
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
|
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
|
RespFileER Boolean `xml:"MSGSETCORE>RESPFILEER"` // server supports file-based error recovery
|
||||||
SpName String `xml:"MSGSETCORE>SPNAME"` // Name of service provider
|
SpName String `xml:"MSGSETCORE>SPNAME"` // Name of service provider
|
||||||
|
@ -233,11 +233,11 @@ NEWFILEUID:NONE
|
|||||||
Name: "SIGNONMSGSETV1",
|
Name: "SIGNONMSGSETV1",
|
||||||
Ver: 1,
|
Ver: 1,
|
||||||
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
|
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
|
||||||
OfxSec: "NONE",
|
OfxSec: ofxgo.OfxSecNone,
|
||||||
TranspSec: true,
|
TranspSec: true,
|
||||||
SignonRealm: "Example Trade",
|
SignonRealm: "Example Trade",
|
||||||
Language: []ofxgo.String{"ENG"},
|
Language: []ofxgo.String{"ENG"},
|
||||||
SyncMode: "LITE",
|
SyncMode: ofxgo.SyncModeLite,
|
||||||
RespFileER: false,
|
RespFileER: false,
|
||||||
// Ignored: <INTU.TIMEOUT>300
|
// Ignored: <INTU.TIMEOUT>300
|
||||||
},
|
},
|
||||||
@ -245,11 +245,11 @@ NEWFILEUID:NONE
|
|||||||
Name: "SIGNUPMSGSETV1",
|
Name: "SIGNUPMSGSETV1",
|
||||||
Ver: 1,
|
Ver: 1,
|
||||||
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
|
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
|
||||||
OfxSec: "NONE",
|
OfxSec: ofxgo.OfxSecNone,
|
||||||
TranspSec: true,
|
TranspSec: true,
|
||||||
SignonRealm: "Example Trade",
|
SignonRealm: "Example Trade",
|
||||||
Language: []ofxgo.String{"ENG"},
|
Language: []ofxgo.String{"ENG"},
|
||||||
SyncMode: "LITE",
|
SyncMode: ofxgo.SyncModeLite,
|
||||||
RespFileER: false,
|
RespFileER: false,
|
||||||
// Ignored: <INTU.TIMEOUT>300
|
// Ignored: <INTU.TIMEOUT>300
|
||||||
},
|
},
|
||||||
@ -257,11 +257,11 @@ NEWFILEUID:NONE
|
|||||||
Name: "INVSTMTMSGSETV1",
|
Name: "INVSTMTMSGSETV1",
|
||||||
Ver: 1,
|
Ver: 1,
|
||||||
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
|
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
|
||||||
OfxSec: "NONE",
|
OfxSec: ofxgo.OfxSecNone,
|
||||||
TranspSec: true,
|
TranspSec: true,
|
||||||
SignonRealm: "Example Trade",
|
SignonRealm: "Example Trade",
|
||||||
Language: []ofxgo.String{"ENG"},
|
Language: []ofxgo.String{"ENG"},
|
||||||
SyncMode: "LITE",
|
SyncMode: ofxgo.SyncModeLite,
|
||||||
RespFileER: false,
|
RespFileER: false,
|
||||||
// Ignored: <INTU.TIMEOUT>300
|
// Ignored: <INTU.TIMEOUT>300
|
||||||
},
|
},
|
||||||
@ -269,11 +269,11 @@ NEWFILEUID:NONE
|
|||||||
Name: "SECLISTMSGSETV1",
|
Name: "SECLISTMSGSETV1",
|
||||||
Ver: 1,
|
Ver: 1,
|
||||||
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
|
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
|
||||||
OfxSec: "NONE",
|
OfxSec: ofxgo.OfxSecNone,
|
||||||
TranspSec: true,
|
TranspSec: true,
|
||||||
SignonRealm: "Example Trade",
|
SignonRealm: "Example Trade",
|
||||||
Language: []ofxgo.String{"ENG"},
|
Language: []ofxgo.String{"ENG"},
|
||||||
SyncMode: "LITE",
|
SyncMode: ofxgo.SyncModeLite,
|
||||||
RespFileER: false,
|
RespFileER: false,
|
||||||
// Ignored: <INTU.TIMEOUT>300
|
// Ignored: <INTU.TIMEOUT>300
|
||||||
},
|
},
|
||||||
@ -281,11 +281,11 @@ NEWFILEUID:NONE
|
|||||||
Name: "PROFMSGSETV1",
|
Name: "PROFMSGSETV1",
|
||||||
Ver: 1,
|
Ver: 1,
|
||||||
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
|
Url: "https://ofx.example.com/cgi-ofx/exampleofx",
|
||||||
OfxSec: "NONE",
|
OfxSec: ofxgo.OfxSecNone,
|
||||||
TranspSec: true,
|
TranspSec: true,
|
||||||
SignonRealm: "Example Trade",
|
SignonRealm: "Example Trade",
|
||||||
Language: []ofxgo.String{"ENG"},
|
Language: []ofxgo.String{"ENG"},
|
||||||
SyncMode: "LITE",
|
SyncMode: ofxgo.SyncModeLite,
|
||||||
RespFileER: false,
|
RespFileER: false,
|
||||||
// Ignored: <INTU.TIMEOUT>300
|
// Ignored: <INTU.TIMEOUT>300
|
||||||
},
|
},
|
||||||
@ -295,7 +295,7 @@ NEWFILEUID:NONE
|
|||||||
SignonRealm: "Example Trade",
|
SignonRealm: "Example Trade",
|
||||||
Min: 1,
|
Min: 1,
|
||||||
Max: 32,
|
Max: 32,
|
||||||
CharType: "ALPHAORNUMERIC",
|
CharType: ofxgo.CharTypeAlphaOrNumeric,
|
||||||
CaseSen: false,
|
CaseSen: false,
|
||||||
Special: true,
|
Special: true,
|
||||||
Spaces: false,
|
Spaces: false,
|
||||||
|
@ -121,6 +121,10 @@ func checkEqual(t *testing.T, fieldName string, expected, actual reflect.Value)
|
|||||||
if expected.String() != actual.String() {
|
if expected.String() != actual.String() {
|
||||||
t.Fatalf("%s: %s expected to be '%s', found '%s'\n", t.Name(), fieldName, 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:
|
default:
|
||||||
t.Fatalf("%s: %s has unexpected type that didn't provide an Equal() method: %s\n", t.Name(), fieldName, expected.Type().Name())
|
t.Fatalf("%s: %s has unexpected type that didn't provide an Equal() method: %s\n", t.Name(), fieldName, expected.Type().Name())
|
||||||
}
|
}
|
||||||
|
68
seclist.go
68
seclist.go
@ -81,22 +81,22 @@ type SecInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DebtInfo struct {
|
type DebtInfo struct {
|
||||||
XMLName xml.Name `xml:"DEBTINFO"`
|
XMLName xml.Name `xml:"DEBTINFO"`
|
||||||
SecInfo SecInfo `xml:"SECINFO"`
|
SecInfo SecInfo `xml:"SECINFO"`
|
||||||
ParValue Amount `xml:"PARVALUE"`
|
ParValue Amount `xml:"PARVALUE"`
|
||||||
DebtType String `xml:"DEBTTYPE"` // One of COUPON, ZERO (zero coupon)
|
DebtType debtType `xml:"DEBTTYPE"` // One of COUPON, ZERO (zero coupon)
|
||||||
DebtClass String `xml:"DEBTCLASS,omitempty"` // One of TREASURY, MUNICIPAL, CORPORATE, OTHER
|
DebtClass debtClass `xml:"DEBTCLASS,omitempty"` // One of TREASURY, MUNICIPAL, CORPORATE, OTHER
|
||||||
CouponRate Amount `xml:"COUPONRT,omitempty"` // Bond coupon rate for next closest call date
|
CouponRate Amount `xml:"COUPONRT,omitempty"` // Bond coupon rate for next closest call date
|
||||||
DtCoupon *Date `xml:"DTCOUPON,omitempty"` // Maturity date for next coupon
|
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
|
CouponFreq couponFreq `xml:"COUPONFREQ,omitempty"` // When coupons mature - one of MONTHLY, QUARTERLY, SEMIANNUAL, ANNUAL, or OTHER
|
||||||
CallPrice Amount `xml:"CALLPRICE,omitempty"` // Bond call price
|
CallPrice Amount `xml:"CALLPRICE,omitempty"` // Bond call price
|
||||||
YieldToCall Amount `xml:"YIELDTOCALL,omitempty"` // Yield to next call
|
YieldToCall Amount `xml:"YIELDTOCALL,omitempty"` // Yield to next call
|
||||||
DtCall *Date `xml:"DTCALL,omitempty"` // Next call date
|
DtCall *Date `xml:"DTCALL,omitempty"` // Next call date
|
||||||
CallType String `xml:"CALLTYPE,omitempt"` // Type of next call. One of CALL, PUT, PREFUND, MATURITY
|
CallType callType `xml:"CALLTYPE,omitempt"` // Type of next call. One of CALL, PUT, PREFUND, MATURITY
|
||||||
YieldToMat Amount `xml:"YIELDTOMAT,omitempty"` // Yield to maturity
|
YieldToMat Amount `xml:"YIELDTOMAT,omitempty"` // Yield to maturity
|
||||||
DtMat *Date `xml:"DTMAT,omitempty"` // Debt maturity date
|
DtMat *Date `xml:"DTMAT,omitempty"` // Debt maturity date
|
||||||
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
|
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i DebtInfo) SecurityType() string {
|
func (i DebtInfo) SecurityType() string {
|
||||||
@ -104,9 +104,9 @@ func (i DebtInfo) SecurityType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AssetPortion struct {
|
type AssetPortion struct {
|
||||||
XMLName xml.Name `xml:"PORTION"`
|
XMLName xml.Name `xml:"PORTION"`
|
||||||
AssetClass String `xml:"ASSETCLASS"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
|
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
|
Percent Amount `xml:"PERCENT"` // Percentage of the fund that falls under this asset class
|
||||||
}
|
}
|
||||||
|
|
||||||
type FiAssetPortion struct {
|
type FiAssetPortion struct {
|
||||||
@ -118,7 +118,7 @@ type FiAssetPortion struct {
|
|||||||
type MFInfo struct {
|
type MFInfo struct {
|
||||||
XMLName xml.Name `xml:"MFINFO"`
|
XMLName xml.Name `xml:"MFINFO"`
|
||||||
SecInfo SecInfo `xml:"SECINFO"`
|
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
|
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
|
DtYieldAsOf *Date `xml:"DTYIELDASOF,omitempty"` // Date YIELD is valid for
|
||||||
AssetClasses []AssetPortion `xml:"MFASSETCLASS>PORTION"`
|
AssetClasses []AssetPortion `xml:"MFASSETCLASS>PORTION"`
|
||||||
@ -132,12 +132,12 @@ func (i MFInfo) SecurityType() string {
|
|||||||
type OptInfo struct {
|
type OptInfo struct {
|
||||||
XMLName xml.Name `xml:"OPTINFO"`
|
XMLName xml.Name `xml:"OPTINFO"`
|
||||||
SecInfo SecInfo `xml:"SECINFO"`
|
SecInfo SecInfo `xml:"SECINFO"`
|
||||||
OptType String `xml:"OPTTYPE"` // One of PUT, CALL
|
OptType optType `xml:"OPTTYPE"` // One of PUT, CALL
|
||||||
StrikePrice Amount `xml:"STRIKEPRICE"`
|
StrikePrice Amount `xml:"STRIKEPRICE"`
|
||||||
DtExpire Date `xml:"DTEXPIRE"` // Expiration date
|
DtExpire Date `xml:"DTEXPIRE"` // Expiration date
|
||||||
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
|
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
|
||||||
SecId *SecurityId `xml:"SECID,omitempty"` // Security ID of the underlying security
|
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
|
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,11 +146,11 @@ func (i OptInfo) SecurityType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OtherInfo struct {
|
type OtherInfo struct {
|
||||||
XMLName xml.Name `xml:"OTHERINFO"`
|
XMLName xml.Name `xml:"OTHERINFO"`
|
||||||
SecInfo SecInfo `xml:"SECINFO"`
|
SecInfo SecInfo `xml:"SECINFO"`
|
||||||
TypeDesc String `xml:"TYPEDESC,omitempty"` // Description of security type
|
TypeDesc String `xml:"TYPEDESC,omitempty"` // Description of security type
|
||||||
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
|
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i OtherInfo) SecurityType() string {
|
func (i OtherInfo) SecurityType() string {
|
||||||
@ -158,13 +158,13 @@ func (i OtherInfo) SecurityType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StockInfo struct {
|
type StockInfo struct {
|
||||||
XMLName xml.Name `xml:"STOCKINFO"`
|
XMLName xml.Name `xml:"STOCKINFO"`
|
||||||
SecInfo SecInfo `xml:"SECINFO"`
|
SecInfo SecInfo `xml:"SECINFO"`
|
||||||
StockType String `xml:"STOCKTYPE,omitempty"` // One of COMMON, PREFERRED, CONVERTIBLE, OTHER
|
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
|
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
|
DtYieldAsOf *Date `xml:"DTYIELDASOF,omitempty"` // Date YIELD is valid for
|
||||||
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
|
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i StockInfo) SecurityType() string {
|
func (i StockInfo) SecurityType() string {
|
||||||
|
78
signup.go
78
signup.go
@ -29,34 +29,34 @@ func (r *AcctInfoRequest) Type() messageType {
|
|||||||
|
|
||||||
type HolderInfo struct {
|
type HolderInfo struct {
|
||||||
XMLName xml.Name
|
XMLName xml.Name
|
||||||
FirstName String `xml:"FIRSTNAME"`
|
FirstName String `xml:"FIRSTNAME"`
|
||||||
MiddleName String `xml:"MIDDLENAME,omitempty"`
|
MiddleName String `xml:"MIDDLENAME,omitempty"`
|
||||||
LastName String `xml:"LASTNAME"`
|
LastName String `xml:"LASTNAME"`
|
||||||
Addr1 String `xml:"ADDR1"`
|
Addr1 String `xml:"ADDR1"`
|
||||||
Addr2 String `xml:"ADDR2,omitempty"`
|
Addr2 String `xml:"ADDR2,omitempty"`
|
||||||
Addr3 String `xml:"ADDR3,omitempty"`
|
Addr3 String `xml:"ADDR3,omitempty"`
|
||||||
City String `xml:"CITY"`
|
City String `xml:"CITY"`
|
||||||
State String `xml:"STATE"`
|
State String `xml:"STATE"`
|
||||||
PostalCode String `xml:"POSTALCODE"`
|
PostalCode String `xml:"POSTALCODE"`
|
||||||
Country String `xml:"COUNTRY,omitempty"`
|
Country String `xml:"COUNTRY,omitempty"`
|
||||||
DayPhone String `xml:"DAYPHONE,omitempty"`
|
DayPhone String `xml:"DAYPHONE,omitempty"`
|
||||||
EvePhone String `xml:"EVEPHONE,omitempty"`
|
EvePhone String `xml:"EVEPHONE,omitempty"`
|
||||||
Email String `xml:"EMAIL,omitempty"`
|
Email String `xml:"EMAIL,omitempty"`
|
||||||
HolderType String `xml:"HOLDERTYPE,omitempty"` // One of INDIVIDUAL, JOINT, CUSTODIAL, TRUST, OTHER
|
HolderType holderType `xml:"HOLDERTYPE,omitempty"` // One of INDIVIDUAL, JOINT, CUSTODIAL, TRUST, OTHER
|
||||||
}
|
}
|
||||||
|
|
||||||
type BankAcctInfo struct {
|
type BankAcctInfo struct {
|
||||||
XMLName xml.Name `xml:"BANKACCTINFO"`
|
XMLName xml.Name `xml:"BANKACCTINFO"`
|
||||||
BankAcctFrom BankAcct `xml:"BANKACCTFROM"`
|
BankAcctFrom BankAcct `xml:"BANKACCTFROM"`
|
||||||
SupTxDl Boolean `xml:"SUPTXDL"` // Supports downloading transactions (as opposed to balance only)
|
SupTxDl Boolean `xml:"SUPTXDL"` // Supports downloading transactions (as opposed to balance only)
|
||||||
XferSrc Boolean `xml:"XFERSRC"` // Enabled as source for intra/interbank transfer
|
XferSrc Boolean `xml:"XFERSRC"` // Enabled as source for intra/interbank transfer
|
||||||
XferDest Boolean `xml:"XFERDEST"` // Enabled as destination 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
|
MaturityDate Date `xml:"MATURITYDATE,omitempty"` // Maturity date for CD, if CD
|
||||||
MaturityAmt Amount `xml:"MATURITYAMOUNT,omitempty"` // Maturity amount 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
|
MinBalReq Amount `xml:"MINBALREQ,omitempty"` // Minimum balance required to avoid service fees
|
||||||
AcctClassification String `xml:"ACCTCLASSIFICATION,omitempty"` // One of PERSONAL, BUSINESS, CORPORATE, OTHER
|
AcctClassification acctClassification `xml:"ACCTCLASSIFICATION,omitempty"` // One of PERSONAL, BUSINESS, CORPORATE, OTHER
|
||||||
OverdraftLimit Amount `xml:"OVERDRAFTLIMIT,omitempty"`
|
OverdraftLimit Amount `xml:"OVERDRAFTLIMIT,omitempty"`
|
||||||
SvcStatus String `xml:"SVCSTATUS"` // One of AVAIL (available, but not yet requested), PEND (requested, but not yet available), ACTIVE
|
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
|
// Make pointers to these structs print nicely
|
||||||
@ -65,13 +65,13 @@ func (bai *BankAcctInfo) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CCAcctInfo struct {
|
type CCAcctInfo struct {
|
||||||
XMLName xml.Name `xml:"CCACCTINFO"`
|
XMLName xml.Name `xml:"CCACCTINFO"`
|
||||||
CCAcctFrom CCAcct `xml:"CCACCTFROM"`
|
CCAcctFrom CCAcct `xml:"CCACCTFROM"`
|
||||||
SupTxDl Boolean `xml:"SUPTXDL"` // Supports downloading transactions (as opposed to balance only)
|
SupTxDl Boolean `xml:"SUPTXDL"` // Supports downloading transactions (as opposed to balance only)
|
||||||
XferSrc Boolean `xml:"XFERSRC"` // Enabled as source for intra/interbank transfer
|
XferSrc Boolean `xml:"XFERSRC"` // Enabled as source for intra/interbank transfer
|
||||||
XferDest Boolean `xml:"XFERDEST"` // Enabled as destination 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
|
AcctClassification acctClassification `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
|
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
|
// Make pointers to these structs print nicely
|
||||||
@ -80,13 +80,13 @@ func (ci *CCAcctInfo) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type InvAcctInfo struct {
|
type InvAcctInfo struct {
|
||||||
XMLName xml.Name `xml:"INVACCTINFO"`
|
XMLName xml.Name `xml:"INVACCTINFO"`
|
||||||
InvAcctFrom InvAcct `xml:"INVACCTFROM"`
|
InvAcctFrom InvAcct `xml:"INVACCTFROM"`
|
||||||
UsProductType String `xml:"USPRODUCTTYPE"` // One of 401K, 403B, IRA, KEOGH, OTHER, SARSEP, SIMPLE, NORMAL, TDA, TRUST, UGMA
|
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
|
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
|
SvcStatus svcStatus `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
|
InvAcctType acctClassification `xml:"INVACCTTYPE,omitempty"` // One of INDIVIDUAL, JOINT, TRUST, CORPORATE
|
||||||
OptionLevel String `xml:"OPTIONLEVEL,omitempty"` // Text desribing option trading privileges
|
OptionLevel String `xml:"OPTIONLEVEL,omitempty"` // Text desribing option trading privileges
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make pointers to these structs print nicely
|
// Make pointers to these structs print nicely
|
||||||
|
@ -126,12 +126,12 @@ func TestUnmarshalAcctInfoResponse(t *testing.T) {
|
|||||||
BankAcctFrom: ofxgo.BankAcct{
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
BankId: "8367556009",
|
BankId: "8367556009",
|
||||||
AcctId: "000999847",
|
AcctId: "000999847",
|
||||||
AcctType: "MONEYMRKT",
|
AcctType: ofxgo.AcctTypeMoneyMrkt,
|
||||||
},
|
},
|
||||||
SupTxDl: true,
|
SupTxDl: true,
|
||||||
XferSrc: true,
|
XferSrc: true,
|
||||||
XferDest: true,
|
XferDest: true,
|
||||||
SvcStatus: "ACTIVE",
|
SvcStatus: ofxgo.SvcStatusActive,
|
||||||
}
|
}
|
||||||
|
|
||||||
acctInfoResponse := ofxgo.AcctInfoResponse{
|
acctInfoResponse := ofxgo.AcctInfoResponse{
|
||||||
|
Loading…
Reference in New Issue
Block a user