mirror of
https://github.com/aclindsa/ofxgo.git
synced 2024-11-22 03:30:04 -05:00
s/Id/ID/
This commit is contained in:
parent
e670b52a08
commit
cc90da4ed1
8
bank.go
8
bank.go
@ -79,10 +79,10 @@ type Transaction struct {
|
|||||||
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"` // Client uses FITID to detect whether it has previously downloaded the transaction
|
FiTID String `xml:"FITID"` // Client uses FITID to detect whether it has previously downloaded the transaction
|
||||||
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 correctAction `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
|
||||||
@ -111,7 +111,7 @@ type TransactionList struct {
|
|||||||
|
|
||||||
// PendingTransaction represents a single pending transaction. It is similar to
|
// PendingTransaction represents a single pending transaction. It is similar to
|
||||||
// Transaction, but is not finalized (and may never be). For instance, it lacks
|
// Transaction, but is not finalized (and may never be). For instance, it lacks
|
||||||
// FiTId and DtPosted fields.
|
// FiTID and DtPosted fields.
|
||||||
type PendingTransaction struct {
|
type PendingTransaction struct {
|
||||||
XMLName xml.Name `xml:"STMTTRNP"`
|
XMLName xml.Name `xml:"STMTTRNP"`
|
||||||
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
|
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
|
||||||
|
24
bank_test.go
24
bank_test.go
@ -43,13 +43,13 @@ func TestMarshalBankStatementRequest(t *testing.T) {
|
|||||||
</OFX>`
|
</OFX>`
|
||||||
|
|
||||||
var client = ofxgo.Client{
|
var client = ofxgo.Client{
|
||||||
AppId: "OFXGO",
|
AppID: "OFXGO",
|
||||||
AppVer: "0001",
|
AppVer: "0001",
|
||||||
SpecVersion: "203",
|
SpecVersion: "203",
|
||||||
}
|
}
|
||||||
|
|
||||||
var request ofxgo.Request
|
var request ofxgo.Request
|
||||||
request.Signon.UserId = "myusername"
|
request.Signon.UserID = "myusername"
|
||||||
request.Signon.UserPass = "Pa$$word"
|
request.Signon.UserPass = "Pa$$word"
|
||||||
request.Signon.Org = "BNK"
|
request.Signon.Org = "BNK"
|
||||||
request.Signon.Fid = "1987"
|
request.Signon.Fid = "1987"
|
||||||
@ -57,8 +57,8 @@ func TestMarshalBankStatementRequest(t *testing.T) {
|
|||||||
statementRequest := ofxgo.StatementRequest{
|
statementRequest := ofxgo.StatementRequest{
|
||||||
TrnUID: "123",
|
TrnUID: "123",
|
||||||
BankAcctFrom: ofxgo.BankAcct{
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
BankId: "318398732",
|
BankID: "318398732",
|
||||||
AcctId: "78346129",
|
AcctID: "78346129",
|
||||||
AcctType: ofxgo.AcctTypeChecking,
|
AcctType: ofxgo.AcctTypeChecking,
|
||||||
},
|
},
|
||||||
Include: true,
|
Include: true,
|
||||||
@ -117,13 +117,13 @@ NEWFILEUID:NONE
|
|||||||
</OFX>`
|
</OFX>`
|
||||||
|
|
||||||
var client = ofxgo.Client{
|
var client = ofxgo.Client{
|
||||||
AppId: "OFXGO",
|
AppID: "OFXGO",
|
||||||
AppVer: "0001",
|
AppVer: "0001",
|
||||||
SpecVersion: "103",
|
SpecVersion: "103",
|
||||||
}
|
}
|
||||||
|
|
||||||
var request ofxgo.Request
|
var request ofxgo.Request
|
||||||
request.Signon.UserId = "myusername"
|
request.Signon.UserID = "myusername"
|
||||||
request.Signon.UserPass = "Pa$$word"
|
request.Signon.UserPass = "Pa$$word"
|
||||||
request.Signon.Org = "BNK"
|
request.Signon.Org = "BNK"
|
||||||
request.Signon.Fid = "1987"
|
request.Signon.Fid = "1987"
|
||||||
@ -131,8 +131,8 @@ NEWFILEUID:NONE
|
|||||||
statementRequest := ofxgo.StatementRequest{
|
statementRequest := ofxgo.StatementRequest{
|
||||||
TrnUID: "123",
|
TrnUID: "123",
|
||||||
BankAcctFrom: ofxgo.BankAcct{
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
BankId: "318398732",
|
BankID: "318398732",
|
||||||
AcctId: "78346129",
|
AcctID: "78346129",
|
||||||
AcctType: ofxgo.AcctTypeChecking,
|
AcctType: ofxgo.AcctTypeChecking,
|
||||||
},
|
},
|
||||||
Include: true,
|
Include: true,
|
||||||
@ -235,7 +235,7 @@ func TestUnmarshalBankStatementResponse(t *testing.T) {
|
|||||||
TrnType: ofxgo.TrnTypeCheck,
|
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",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -243,7 +243,7 @@ func TestUnmarshalBankStatementResponse(t *testing.T) {
|
|||||||
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,
|
||||||
FiTId: "00679",
|
FiTID: "00679",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -260,8 +260,8 @@ func TestUnmarshalBankStatementResponse(t *testing.T) {
|
|||||||
},
|
},
|
||||||
CurDef: "USD",
|
CurDef: "USD",
|
||||||
BankAcctFrom: ofxgo.BankAcct{
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
BankId: "318398732",
|
BankID: "318398732",
|
||||||
AcctId: "78346129",
|
AcctID: "78346129",
|
||||||
AcctType: ofxgo.AcctTypeChecking,
|
AcctType: ofxgo.AcctTypeChecking,
|
||||||
},
|
},
|
||||||
BankTranList: &banktranlist,
|
BankTranList: &banktranlist,
|
||||||
|
10
client.go
10
client.go
@ -11,7 +11,7 @@ type Client struct {
|
|||||||
// Request fields to overwrite with the client's values. If nonempty,
|
// Request fields to overwrite with the client's values. If nonempty,
|
||||||
// defaults are used
|
// defaults are used
|
||||||
SpecVersion string // VERSION in header
|
SpecVersion string // VERSION in header
|
||||||
AppId string // SONRQ>APPID
|
AppID string // SONRQ>APPID
|
||||||
AppVer string // SONRQ>APPVER
|
AppVer string // SONRQ>APPVER
|
||||||
|
|
||||||
// Don't insert newlines or indentation when marshalling to SGML/XML
|
// Don't insert newlines or indentation when marshalling to SGML/XML
|
||||||
@ -28,9 +28,9 @@ func (c *Client) OfxVersion() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Id() String {
|
func (c *Client) ID() String {
|
||||||
if len(c.AppId) > 0 {
|
if len(c.AppID) > 0 {
|
||||||
return String(c.AppId)
|
return String(c.AppID)
|
||||||
} else {
|
} else {
|
||||||
return String("OFXGO")
|
return String("OFXGO")
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ func (c *Client) RequestNoParse(r *Request) (*http.Response, error) {
|
|||||||
//
|
//
|
||||||
// Before being marshaled, some of the the Request object's values are
|
// Before being marshaled, some of the the Request object's values are
|
||||||
// overwritten, namely those dictated by the Client's configuration (Version,
|
// overwritten, namely those dictated by the Client's configuration (Version,
|
||||||
// AppId, AppVer fields), and the client's curren time (DtClient). These are
|
// AppID, AppVer fields), and the client's curren time (DtClient). These are
|
||||||
// updated in place in the supplied Request object so they may later be
|
// updated in place in the supplied Request object so they may later be
|
||||||
// inspected by the caller.
|
// inspected by the caller.
|
||||||
func (c *Client) Request(r *Request) (*Response, error) {
|
func (c *Client) Request(r *Request) (*Response, error) {
|
||||||
|
@ -16,13 +16,13 @@ var downloadCommand = Command{
|
|||||||
Do: download,
|
Do: download,
|
||||||
}
|
}
|
||||||
|
|
||||||
var filename, bankId, acctId, acctType string
|
var filename, bankID, acctID, acctType string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
defineServerFlags(downloadCommand.Flags)
|
defineServerFlags(downloadCommand.Flags)
|
||||||
downloadCommand.Flags.StringVar(&filename, "filename", "./download.ofx", "The file to save to")
|
downloadCommand.Flags.StringVar(&filename, "filename", "./download.ofx", "The file to save to")
|
||||||
downloadCommand.Flags.StringVar(&bankId, "bankid", "", "BankId (from `get-accounts` subcommand)")
|
downloadCommand.Flags.StringVar(&bankID, "bankid", "", "BankID (from `get-accounts` subcommand)")
|
||||||
downloadCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
downloadCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||||
downloadCommand.Flags.StringVar(&acctType, "accttype", "CHECKING", "AcctType (from `get-accounts` subcommand)")
|
downloadCommand.Flags.StringVar(&acctType, "accttype", "CHECKING", "AcctType (from `get-accounts` subcommand)")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,8 +55,8 @@ func download() {
|
|||||||
statementRequest := ofxgo.StatementRequest{
|
statementRequest := ofxgo.StatementRequest{
|
||||||
TrnUID: *uid,
|
TrnUID: *uid,
|
||||||
BankAcctFrom: ofxgo.BankAcct{
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
BankId: ofxgo.String(bankId),
|
BankID: ofxgo.String(bankID),
|
||||||
AcctId: ofxgo.String(acctId),
|
AcctID: ofxgo.String(acctID),
|
||||||
AcctType: acctTypeEnum,
|
AcctType: acctTypeEnum,
|
||||||
},
|
},
|
||||||
Include: true,
|
Include: true,
|
||||||
|
@ -17,8 +17,8 @@ var bankTransactionsCommand = Command{
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
defineServerFlags(bankTransactionsCommand.Flags)
|
defineServerFlags(bankTransactionsCommand.Flags)
|
||||||
bankTransactionsCommand.Flags.StringVar(&bankId, "bankid", "", "BankId (from `get-accounts` subcommand)")
|
bankTransactionsCommand.Flags.StringVar(&bankID, "bankid", "", "BankID (from `get-accounts` subcommand)")
|
||||||
bankTransactionsCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
bankTransactionsCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||||
bankTransactionsCommand.Flags.StringVar(&acctType, "accttype", "CHECKING", "AcctType (from `get-accounts` subcommand)")
|
bankTransactionsCommand.Flags.StringVar(&acctType, "accttype", "CHECKING", "AcctType (from `get-accounts` subcommand)")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,8 +40,8 @@ func bankTransactions() {
|
|||||||
statementRequest := ofxgo.StatementRequest{
|
statementRequest := ofxgo.StatementRequest{
|
||||||
TrnUID: *uid,
|
TrnUID: *uid,
|
||||||
BankAcctFrom: ofxgo.BankAcct{
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
BankId: ofxgo.String(bankId),
|
BankID: ofxgo.String(bankID),
|
||||||
AcctId: ofxgo.String(acctId),
|
AcctID: ofxgo.String(acctID),
|
||||||
AcctType: acctTypeEnum,
|
AcctType: acctTypeEnum,
|
||||||
},
|
},
|
||||||
Include: true,
|
Include: true,
|
||||||
|
@ -19,7 +19,7 @@ var ccDownloadCommand = Command{
|
|||||||
func init() {
|
func init() {
|
||||||
defineServerFlags(ccDownloadCommand.Flags)
|
defineServerFlags(ccDownloadCommand.Flags)
|
||||||
ccDownloadCommand.Flags.StringVar(&filename, "filename", "./download.ofx", "The file to save to")
|
ccDownloadCommand.Flags.StringVar(&filename, "filename", "./download.ofx", "The file to save to")
|
||||||
ccDownloadCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
ccDownloadCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||||
}
|
}
|
||||||
|
|
||||||
func ccDownloadCheckFlags() bool {
|
func ccDownloadCheckFlags() bool {
|
||||||
@ -45,7 +45,7 @@ func ccDownload() {
|
|||||||
statementRequest := ofxgo.CCStatementRequest{
|
statementRequest := ofxgo.CCStatementRequest{
|
||||||
TrnUID: *uid,
|
TrnUID: *uid,
|
||||||
CCAcctFrom: ofxgo.CCAcct{
|
CCAcctFrom: ofxgo.CCAcct{
|
||||||
AcctId: ofxgo.String(acctId),
|
AcctID: ofxgo.String(acctID),
|
||||||
},
|
},
|
||||||
Include: true,
|
Include: true,
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ var ccTransactionsCommand = Command{
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
defineServerFlags(ccTransactionsCommand.Flags)
|
defineServerFlags(ccTransactionsCommand.Flags)
|
||||||
ccTransactionsCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
ccTransactionsCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||||
}
|
}
|
||||||
|
|
||||||
func ccTransactions() {
|
func ccTransactions() {
|
||||||
@ -32,7 +32,7 @@ func ccTransactions() {
|
|||||||
statementRequest := ofxgo.CCStatementRequest{
|
statementRequest := ofxgo.CCStatementRequest{
|
||||||
TrnUID: *uid,
|
TrnUID: *uid,
|
||||||
CCAcctFrom: ofxgo.CCAcct{
|
CCAcctFrom: ofxgo.CCAcct{
|
||||||
AcctId: ofxgo.String(acctId),
|
AcctID: ofxgo.String(acctID),
|
||||||
},
|
},
|
||||||
Include: true,
|
Include: true,
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ func (c *Command) Usage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// flags common to all server transactions
|
// flags common to all server transactions
|
||||||
var serverURL, username, password, org, fid, appId, appVer, ofxVersion, clientUID string
|
var serverURL, username, password, org, fid, appID, appVer, ofxVersion, clientUID string
|
||||||
var noIndentRequests bool
|
var noIndentRequests bool
|
||||||
|
|
||||||
func defineServerFlags(f *flag.FlagSet) {
|
func defineServerFlags(f *flag.FlagSet) {
|
||||||
@ -29,7 +29,7 @@ func defineServerFlags(f *flag.FlagSet) {
|
|||||||
f.StringVar(&password, "password", "", "Your password at financial institution")
|
f.StringVar(&password, "password", "", "Your password at financial institution")
|
||||||
f.StringVar(&org, "org", "", "'ORG' for your financial institution")
|
f.StringVar(&org, "org", "", "'ORG' for your financial institution")
|
||||||
f.StringVar(&fid, "fid", "", "'FID' for your financial institution")
|
f.StringVar(&fid, "fid", "", "'FID' for your financial institution")
|
||||||
f.StringVar(&appId, "appid", "QWIN", "'APPID' to pretend to be")
|
f.StringVar(&appID, "appid", "QWIN", "'APPID' to pretend to be")
|
||||||
f.StringVar(&appVer, "appver", "2400", "'APPVER' to pretend to be")
|
f.StringVar(&appVer, "appver", "2400", "'APPVER' to pretend to be")
|
||||||
f.StringVar(&ofxVersion, "ofxversion", "203", "OFX version to use")
|
f.StringVar(&ofxVersion, "ofxversion", "203", "OFX version to use")
|
||||||
f.StringVar(&clientUID, "clientuid", "", "Client UID (only required by a few FIs, like Chase)")
|
f.StringVar(&clientUID, "clientuid", "", "Client UID (only required by a few FIs, like Chase)")
|
||||||
|
@ -30,7 +30,7 @@ func init() {
|
|||||||
// We keep a separate list of APPIDs to preserve the ordering (ordering isn't
|
// We keep a separate list of APPIDs to preserve the ordering (ordering isn't
|
||||||
// guaranteed in maps). We want to try them in order from 'best' and most
|
// guaranteed in maps). We want to try them in order from 'best' and most
|
||||||
// likely to work to 'worse' and least likely to work
|
// likely to work to 'worse' and least likely to work
|
||||||
var appIds = []string{
|
var appIDs = []string{
|
||||||
"OFXGO", // ofxgo (this library)
|
"OFXGO", // ofxgo (this library)
|
||||||
"QWIN", // Intuit Quicken Windows
|
"QWIN", // Intuit Quicken Windows
|
||||||
"QMOFX", // Intuit Quicken Mac
|
"QMOFX", // Intuit Quicken Mac
|
||||||
@ -92,13 +92,13 @@ var versions = []string{
|
|||||||
|
|
||||||
func detectSettings() {
|
func detectSettings() {
|
||||||
var attempts uint
|
var attempts uint
|
||||||
for _, appId := range appIds {
|
for _, appID := range appIDs {
|
||||||
for _, appVer := range appVersions[appId] {
|
for _, appVer := range appVersions[appID] {
|
||||||
for _, version := range versions {
|
for _, version := range versions {
|
||||||
for _, noIndent := range []bool{false, true} {
|
for _, noIndent := range []bool{false, true} {
|
||||||
if tryProfile(appId, appVer, version, noIndent) {
|
if tryProfile(appID, appVer, version, noIndent) {
|
||||||
fmt.Println("The following settings were found to work:")
|
fmt.Println("The following settings were found to work:")
|
||||||
fmt.Printf("AppId: %s\n", appId)
|
fmt.Printf("AppID: %s\n", appID)
|
||||||
fmt.Printf("AppVer: %s\n", appVer)
|
fmt.Printf("AppVer: %s\n", appVer)
|
||||||
fmt.Printf("OFX Version: %s\n", version)
|
fmt.Printf("OFX Version: %s\n", version)
|
||||||
fmt.Printf("noindent: %t\n", noIndent)
|
fmt.Printf("noindent: %t\n", noIndent)
|
||||||
@ -109,7 +109,7 @@ func detectSettings() {
|
|||||||
if noIndent {
|
if noIndent {
|
||||||
noIndentString = " noindent"
|
noIndentString = " noindent"
|
||||||
}
|
}
|
||||||
fmt.Printf("Attempt %d failed (%s %s %s%s), trying again after %dms...\n", attempts, appId, appVer, version, noIndentString, delay)
|
fmt.Printf("Attempt %d failed (%s %s %s%s), trying again after %dms...\n", attempts, appID, appVer, version, noIndentString, delay)
|
||||||
time.Sleep(time.Duration(delay) * time.Millisecond)
|
time.Sleep(time.Duration(delay) * time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,9 +120,9 @@ func detectSettings() {
|
|||||||
|
|
||||||
const anonymous = "anonymous00000000000000000000000"
|
const anonymous = "anonymous00000000000000000000000"
|
||||||
|
|
||||||
func tryProfile(appId, appVer, version string, noindent bool) bool {
|
func tryProfile(appID, appVer, version string, noindent bool) bool {
|
||||||
var client = ofxgo.Client{
|
var client = ofxgo.Client{
|
||||||
AppId: appId,
|
AppID: appID,
|
||||||
AppVer: appVer,
|
AppVer: appVer,
|
||||||
SpecVersion: version,
|
SpecVersion: version,
|
||||||
NoIndent: noindent,
|
NoIndent: noindent,
|
||||||
@ -131,7 +131,7 @@ func tryProfile(appId, appVer, version string, noindent bool) bool {
|
|||||||
var query ofxgo.Request
|
var query ofxgo.Request
|
||||||
query.URL = serverURL
|
query.URL = serverURL
|
||||||
query.Signon.ClientUID = ofxgo.UID(clientUID)
|
query.Signon.ClientUID = ofxgo.UID(clientUID)
|
||||||
query.Signon.UserId = ofxgo.String(username)
|
query.Signon.UserID = ofxgo.String(username)
|
||||||
query.Signon.UserPass = ofxgo.String(password)
|
query.Signon.UserPass = ofxgo.String(password)
|
||||||
query.Signon.Org = ofxgo.String(org)
|
query.Signon.Org = ofxgo.String(org)
|
||||||
query.Signon.Fid = ofxgo.String(fid)
|
query.Signon.Fid = ofxgo.String(fid)
|
||||||
@ -154,7 +154,7 @@ func tryProfile(appId, appVer, version string, noindent bool) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// try again with anonymous logins
|
// try again with anonymous logins
|
||||||
query.Signon.UserId = ofxgo.String(anonymous)
|
query.Signon.UserID = ofxgo.String(anonymous)
|
||||||
query.Signon.UserPass = ofxgo.String(anonymous)
|
query.Signon.UserPass = ofxgo.String(anonymous)
|
||||||
|
|
||||||
_, err = client.Request(&query)
|
_, err = client.Request(&query)
|
||||||
|
@ -57,11 +57,11 @@ func getAccounts() {
|
|||||||
if acctinfo, ok := response.Signup[0].(*ofxgo.AcctInfoResponse); ok {
|
if acctinfo, ok := response.Signup[0].(*ofxgo.AcctInfoResponse); ok {
|
||||||
for _, acct := range acctinfo.AcctInfo {
|
for _, acct := range acctinfo.AcctInfo {
|
||||||
if acct.BankAcctInfo != nil {
|
if acct.BankAcctInfo != nil {
|
||||||
fmt.Printf("Bank Account:\n\tBankId: \"%s\"\n\tAcctId: \"%s\"\n\tAcctType: %s\n", acct.BankAcctInfo.BankAcctFrom.BankId, acct.BankAcctInfo.BankAcctFrom.AcctId, acct.BankAcctInfo.BankAcctFrom.AcctType)
|
fmt.Printf("Bank Account:\n\tBankID: \"%s\"\n\tAcctID: \"%s\"\n\tAcctType: %s\n", acct.BankAcctInfo.BankAcctFrom.BankID, acct.BankAcctInfo.BankAcctFrom.AcctID, acct.BankAcctInfo.BankAcctFrom.AcctType)
|
||||||
} else if acct.CCAcctInfo != nil {
|
} else if acct.CCAcctInfo != nil {
|
||||||
fmt.Printf("Credit card:\n\tAcctId: \"%s\"\n", acct.CCAcctInfo.CCAcctFrom.AcctId)
|
fmt.Printf("Credit card:\n\tAcctID: \"%s\"\n", acct.CCAcctInfo.CCAcctFrom.AcctID)
|
||||||
} else if acct.InvAcctInfo != nil {
|
} else if acct.InvAcctInfo != nil {
|
||||||
fmt.Printf("Investment account:\n\tBrokerId: \"%s\"\n\tAcctId: \"%s\"\n", acct.InvAcctInfo.InvAcctFrom.BrokerId, acct.InvAcctInfo.InvAcctFrom.AcctId)
|
fmt.Printf("Investment account:\n\tBrokerID: \"%s\"\n\tAcctID: \"%s\"\n", acct.InvAcctInfo.InvAcctFrom.BrokerID, acct.InvAcctInfo.InvAcctFrom.AcctID)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("Unknown type: %s %s\n", acct.Name, acct.Desc)
|
fmt.Printf("Unknown type: %s %s\n", acct.Name, acct.Desc)
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,13 @@ var invDownloadCommand = Command{
|
|||||||
Do: invDownload,
|
Do: invDownload,
|
||||||
}
|
}
|
||||||
|
|
||||||
var brokerId string
|
var brokerID string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
defineServerFlags(invDownloadCommand.Flags)
|
defineServerFlags(invDownloadCommand.Flags)
|
||||||
invDownloadCommand.Flags.StringVar(&filename, "filename", "./download.ofx", "The file to save to")
|
invDownloadCommand.Flags.StringVar(&filename, "filename", "./download.ofx", "The file to save to")
|
||||||
invDownloadCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
invDownloadCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||||
invDownloadCommand.Flags.StringVar(&brokerId, "brokerid", "", "BrokerId (from `get-accounts` subcommand)")
|
invDownloadCommand.Flags.StringVar(&brokerID, "brokerid", "", "BrokerID (from `get-accounts` subcommand)")
|
||||||
}
|
}
|
||||||
|
|
||||||
func invDownloadCheckFlags() bool {
|
func invDownloadCheckFlags() bool {
|
||||||
@ -48,8 +48,8 @@ func invDownload() {
|
|||||||
statementRequest := ofxgo.InvStatementRequest{
|
statementRequest := ofxgo.InvStatementRequest{
|
||||||
TrnUID: *uid,
|
TrnUID: *uid,
|
||||||
InvAcctFrom: ofxgo.InvAcct{
|
InvAcctFrom: ofxgo.InvAcct{
|
||||||
BrokerId: ofxgo.String(brokerId),
|
BrokerID: ofxgo.String(brokerID),
|
||||||
AcctId: ofxgo.String(acctId),
|
AcctID: ofxgo.String(acctID),
|
||||||
},
|
},
|
||||||
Include: true,
|
Include: true,
|
||||||
IncludeOO: true,
|
IncludeOO: true,
|
||||||
|
@ -17,8 +17,8 @@ var invTransactionsCommand = Command{
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
defineServerFlags(invTransactionsCommand.Flags)
|
defineServerFlags(invTransactionsCommand.Flags)
|
||||||
invTransactionsCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
invTransactionsCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||||
invTransactionsCommand.Flags.StringVar(&brokerId, "brokerid", "", "BrokerId (from `get-accounts` subcommand)")
|
invTransactionsCommand.Flags.StringVar(&brokerID, "brokerid", "", "BrokerID (from `get-accounts` subcommand)")
|
||||||
}
|
}
|
||||||
|
|
||||||
func invTransactions() {
|
func invTransactions() {
|
||||||
@ -33,8 +33,8 @@ func invTransactions() {
|
|||||||
statementRequest := ofxgo.InvStatementRequest{
|
statementRequest := ofxgo.InvStatementRequest{
|
||||||
TrnUID: *uid,
|
TrnUID: *uid,
|
||||||
InvAcctFrom: ofxgo.InvAcct{
|
InvAcctFrom: ofxgo.InvAcct{
|
||||||
BrokerId: ofxgo.String(brokerId),
|
BrokerID: ofxgo.String(brokerID),
|
||||||
AcctId: ofxgo.String(acctId),
|
AcctID: ofxgo.String(acctID),
|
||||||
},
|
},
|
||||||
Include: true,
|
Include: true,
|
||||||
IncludeOO: true,
|
IncludeOO: true,
|
||||||
@ -99,7 +99,7 @@ func invTransactions() {
|
|||||||
} else if tran.OrigCurrency != nil {
|
} else if tran.OrigCurrency != nil {
|
||||||
currency = tran.Currency.CurSym
|
currency = tran.Currency.CurSym
|
||||||
}
|
}
|
||||||
fmt.Printf(" %s %s %s (%s %s)\n", tran.IncomeType, tran.Total, currency, tran.SecId.UniqueIdType, tran.SecId.UniqueId)
|
fmt.Printf(" %s %s %s (%s %s)\n", tran.IncomeType, tran.Total, currency, tran.SecID.UniqueIDType, tran.SecID.UniqueID)
|
||||||
// TODO print ticker instead of CUSIP
|
// TODO print ticker instead of CUSIP
|
||||||
case ofxgo.InvExpense:
|
case ofxgo.InvExpense:
|
||||||
printInvTran(&tran.InvTran)
|
printInvTran(&tran.InvTran)
|
||||||
@ -109,14 +109,14 @@ func invTransactions() {
|
|||||||
} else if tran.OrigCurrency != nil {
|
} else if tran.OrigCurrency != nil {
|
||||||
currency = tran.Currency.CurSym
|
currency = tran.Currency.CurSym
|
||||||
}
|
}
|
||||||
fmt.Printf(" %s %s (%s %s)\n", tran.Total, currency, tran.SecId.UniqueIdType, tran.SecId.UniqueId)
|
fmt.Printf(" %s %s (%s %s)\n", tran.Total, currency, tran.SecID.UniqueIDType, tran.SecID.UniqueID)
|
||||||
// TODO print ticker instead of CUSIP
|
// TODO print ticker instead of CUSIP
|
||||||
case ofxgo.JrnlFund:
|
case ofxgo.JrnlFund:
|
||||||
printInvTran(&tran.InvTran)
|
printInvTran(&tran.InvTran)
|
||||||
fmt.Printf(" %s %s (%s -> %s)\n", tran.Total, stmt.CurDef, tran.SubAcctFrom, tran.SubAcctTo)
|
fmt.Printf(" %s %s (%s -> %s)\n", tran.Total, stmt.CurDef, tran.SubAcctFrom, tran.SubAcctTo)
|
||||||
case ofxgo.JrnlSec:
|
case ofxgo.JrnlSec:
|
||||||
printInvTran(&tran.InvTran)
|
printInvTran(&tran.InvTran)
|
||||||
fmt.Printf(" %s %s %s (%s -> %s)\n", tran.Units, tran.SecId.UniqueIdType, tran.SecId.UniqueId, tran.SubAcctFrom, tran.SubAcctTo)
|
fmt.Printf(" %s %s %s (%s -> %s)\n", tran.Units, tran.SecID.UniqueIDType, tran.SecID.UniqueID, tran.SubAcctFrom, tran.SubAcctTo)
|
||||||
// TODO print ticker instead of CUSIP
|
// TODO print ticker instead of CUSIP
|
||||||
case ofxgo.MarginInterest:
|
case ofxgo.MarginInterest:
|
||||||
printInvTran(&tran.InvTran)
|
printInvTran(&tran.InvTran)
|
||||||
@ -135,7 +135,7 @@ func invTransactions() {
|
|||||||
} else if tran.OrigCurrency != nil {
|
} else if tran.OrigCurrency != nil {
|
||||||
currency = tran.Currency.CurSym
|
currency = tran.Currency.CurSym
|
||||||
}
|
}
|
||||||
fmt.Printf(" %s (%s %s)@%s %s (Total: %s)\n", tran.Units, tran.SecId.UniqueIdType, tran.SecId.UniqueId, tran.UnitPrice, currency, tran.Total)
|
fmt.Printf(" %s (%s %s)@%s %s (Total: %s)\n", tran.Units, tran.SecID.UniqueIDType, tran.SecID.UniqueID, tran.UnitPrice, currency, tran.Total)
|
||||||
// TODO print ticker instead of CUSIP
|
// TODO print ticker instead of CUSIP
|
||||||
case ofxgo.RetOfCap:
|
case ofxgo.RetOfCap:
|
||||||
printInvTran(&tran.InvTran)
|
printInvTran(&tran.InvTran)
|
||||||
@ -145,7 +145,7 @@ func invTransactions() {
|
|||||||
} else if tran.OrigCurrency != nil {
|
} else if tran.OrigCurrency != nil {
|
||||||
currency = tran.Currency.CurSym
|
currency = tran.Currency.CurSym
|
||||||
}
|
}
|
||||||
fmt.Printf(" %s %s (%s %s)\n", tran.Total, currency, tran.SecId.UniqueIdType, tran.SecId.UniqueId)
|
fmt.Printf(" %s %s (%s %s)\n", tran.Total, currency, tran.SecID.UniqueIDType, tran.SecID.UniqueID)
|
||||||
// TODO print ticker instead of CUSIP
|
// TODO print ticker instead of CUSIP
|
||||||
case ofxgo.SellDebt:
|
case ofxgo.SellDebt:
|
||||||
printInvSell(stmt.CurDef, &tran.InvSell)
|
printInvSell(stmt.CurDef, &tran.InvSell)
|
||||||
@ -165,11 +165,11 @@ func invTransactions() {
|
|||||||
} else if tran.OrigCurrency != nil {
|
} else if tran.OrigCurrency != nil {
|
||||||
currency = tran.Currency.CurSym
|
currency = tran.Currency.CurSym
|
||||||
}
|
}
|
||||||
fmt.Printf(" %d/%d %s -> %s shares of %s %s (%s %s for fractional shares)\n", tran.Numerator, tran.Denominator, tran.OldUnits, tran.NewUnits, tran.SecId.UniqueIdType, tran.SecId.UniqueId, tran.FracCash, currency)
|
fmt.Printf(" %d/%d %s -> %s shares of %s %s (%s %s for fractional shares)\n", tran.Numerator, tran.Denominator, tran.OldUnits, tran.NewUnits, tran.SecID.UniqueIDType, tran.SecID.UniqueID, tran.FracCash, currency)
|
||||||
// TODO print ticker instead of CUSIP
|
// TODO print ticker instead of CUSIP
|
||||||
case ofxgo.Transfer:
|
case ofxgo.Transfer:
|
||||||
printInvTran(&tran.InvTran)
|
printInvTran(&tran.InvTran)
|
||||||
fmt.Printf(" %s (%s %s) %s\n", tran.Units, tran.SecId.UniqueIdType, tran.SecId.UniqueId, tran.TferAction)
|
fmt.Printf(" %s (%s %s) %s\n", tran.Units, tran.SecID.UniqueIDType, tran.SecID.UniqueID, tran.TferAction)
|
||||||
// TODO print ticker instead of CUSIP
|
// TODO print ticker instead of CUSIP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,7 +189,7 @@ func printInvBuy(defCurrency ofxgo.String, ib *ofxgo.InvBuy) {
|
|||||||
currency = ib.Currency.CurSym
|
currency = ib.Currency.CurSym
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("%s (%s %s)@%s %s (Total: %s)\n", ib.Units, ib.SecId.UniqueIdType, ib.SecId.UniqueId, ib.UnitPrice, currency, ib.Total)
|
fmt.Printf("%s (%s %s)@%s %s (Total: %s)\n", ib.Units, ib.SecID.UniqueIDType, ib.SecID.UniqueID, ib.UnitPrice, currency, ib.Total)
|
||||||
// TODO print ticker instead of CUSIP
|
// TODO print ticker instead of CUSIP
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,6 +202,6 @@ func printInvSell(defCurrency ofxgo.String, is *ofxgo.InvSell) {
|
|||||||
currency = is.Currency.CurSym
|
currency = is.Currency.CurSym
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf(" %s (%s %s)@%s %s (Total: %s)\n", is.Units, is.SecId.UniqueIdType, is.SecId.UniqueId, is.UnitPrice, currency, is.Total)
|
fmt.Printf(" %s (%s %s)@%s %s (Total: %s)\n", is.Units, is.SecID.UniqueIDType, is.SecID.UniqueID, is.UnitPrice, currency, is.Total)
|
||||||
// TODO print ticker instead of CUSIP
|
// TODO print ticker instead of CUSIP
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
func NewRequest() (*ofxgo.Client, *ofxgo.Request) {
|
func NewRequest() (*ofxgo.Client, *ofxgo.Request) {
|
||||||
var client = ofxgo.Client{
|
var client = ofxgo.Client{
|
||||||
AppId: appId,
|
AppID: appID,
|
||||||
AppVer: appVer,
|
AppVer: appVer,
|
||||||
SpecVersion: ofxVersion,
|
SpecVersion: ofxVersion,
|
||||||
NoIndent: noIndentRequests,
|
NoIndent: noIndentRequests,
|
||||||
@ -15,7 +15,7 @@ func NewRequest() (*ofxgo.Client, *ofxgo.Request) {
|
|||||||
var query ofxgo.Request
|
var query ofxgo.Request
|
||||||
query.URL = serverURL
|
query.URL = serverURL
|
||||||
query.Signon.ClientUID = ofxgo.UID(clientUID)
|
query.Signon.ClientUID = ofxgo.UID(clientUID)
|
||||||
query.Signon.UserId = ofxgo.String(username)
|
query.Signon.UserID = ofxgo.String(username)
|
||||||
query.Signon.UserPass = ofxgo.String(password)
|
query.Signon.UserPass = ofxgo.String(password)
|
||||||
query.Signon.Org = ofxgo.String(org)
|
query.Signon.Org = ofxgo.String(org)
|
||||||
query.Signon.Fid = ofxgo.String(fid)
|
query.Signon.Fid = ofxgo.String(fid)
|
||||||
|
12
common.go
12
common.go
@ -267,9 +267,9 @@ func (s *Status) CodeConditions() (string, error) {
|
|||||||
// BankAcct represents the identifying information for one bank account
|
// BankAcct represents the identifying information for one bank account
|
||||||
type BankAcct struct {
|
type BankAcct struct {
|
||||||
XMLName xml.Name // BANKACCTTO or BANKACCTFROM
|
XMLName xml.Name // BANKACCTTO or BANKACCTFROM
|
||||||
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 acctType `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
|
||||||
}
|
}
|
||||||
@ -277,15 +277,15 @@ type BankAcct struct {
|
|||||||
// CCAcct represents the identifying information for one checking account
|
// CCAcct represents the identifying information for one checking account
|
||||||
type CCAcct struct {
|
type CCAcct struct {
|
||||||
XMLName xml.Name // CCACCTTO or CCACCTFROM
|
XMLName xml.Name // CCACCTTO or CCACCTFROM
|
||||||
AcctId String `xml:"ACCTID"`
|
AcctID String `xml:"ACCTID"`
|
||||||
AcctKey String `xml:"ACCTKEY,omitempty"` // Unused in USA
|
AcctKey String `xml:"ACCTKEY,omitempty"` // Unused in USA
|
||||||
}
|
}
|
||||||
|
|
||||||
// InvAcct represents the identifying information for one investment account
|
// InvAcct represents the identifying information for one investment account
|
||||||
type InvAcct struct {
|
type InvAcct struct {
|
||||||
XMLName xml.Name // INVACCTTO or INVACCTFROM
|
XMLName xml.Name // INVACCTTO or INVACCTFROM
|
||||||
BrokerId String `xml:"BROKERID"`
|
BrokerID String `xml:"BROKERID"`
|
||||||
AcctId String `xml:"ACCTID"`
|
AcctID String `xml:"ACCTID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currency represents one ISO-4217 currency
|
// Currency represents one ISO-4217 currency
|
||||||
|
@ -42,13 +42,13 @@ func TestMarshalCCStatementRequest(t *testing.T) {
|
|||||||
</OFX>`
|
</OFX>`
|
||||||
|
|
||||||
var client = ofxgo.Client{
|
var client = ofxgo.Client{
|
||||||
AppId: "OFXGO",
|
AppID: "OFXGO",
|
||||||
AppVer: "0001",
|
AppVer: "0001",
|
||||||
SpecVersion: "203",
|
SpecVersion: "203",
|
||||||
}
|
}
|
||||||
|
|
||||||
var request ofxgo.Request
|
var request ofxgo.Request
|
||||||
request.Signon.UserId = "myusername"
|
request.Signon.UserID = "myusername"
|
||||||
request.Signon.UserPass = "Pa$$word"
|
request.Signon.UserPass = "Pa$$word"
|
||||||
request.Signon.Org = "BNK"
|
request.Signon.Org = "BNK"
|
||||||
request.Signon.Fid = "1987"
|
request.Signon.Fid = "1987"
|
||||||
@ -56,7 +56,7 @@ func TestMarshalCCStatementRequest(t *testing.T) {
|
|||||||
statementRequest := ofxgo.CCStatementRequest{
|
statementRequest := ofxgo.CCStatementRequest{
|
||||||
TrnUID: "913846",
|
TrnUID: "913846",
|
||||||
CCAcctFrom: ofxgo.CCAcct{
|
CCAcctFrom: ofxgo.CCAcct{
|
||||||
AcctId: "XXXXXXXXXXXX1234",
|
AcctID: "XXXXXXXXXXXX1234",
|
||||||
},
|
},
|
||||||
DtStart: ofxgo.NewDateGMT(2017, 1, 1, 0, 0, 0, 0),
|
DtStart: ofxgo.NewDateGMT(2017, 1, 1, 0, 0, 0, 0),
|
||||||
Include: true,
|
Include: true,
|
||||||
@ -108,21 +108,21 @@ NEWFILEUID:NONE
|
|||||||
TrnType: ofxgo.TrnTypeDebit,
|
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: ofxgo.TrnTypeCredit,
|
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: ofxgo.TrnTypeDebit,
|
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",
|
||||||
Name: "KROGER FUEL #9999",
|
Name: "KROGER FUEL #9999",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -140,7 +140,7 @@ NEWFILEUID:NONE
|
|||||||
},
|
},
|
||||||
CurDef: "USD",
|
CurDef: "USD",
|
||||||
CCAcctFrom: ofxgo.CCAcct{
|
CCAcctFrom: ofxgo.CCAcct{
|
||||||
AcctId: "9283744488463775",
|
AcctID: "9283744488463775",
|
||||||
},
|
},
|
||||||
BankTranList: &banktranlist,
|
BankTranList: &banktranlist,
|
||||||
BalAmt: balamt,
|
BalAmt: balamt,
|
||||||
|
50
invstmt.go
50
invstmt.go
@ -39,18 +39,18 @@ func (r *InvStatementRequest) Type() messageType {
|
|||||||
|
|
||||||
type InvTran struct {
|
type InvTran struct {
|
||||||
XMLName xml.Name `xml:"INVTRAN"`
|
XMLName xml.Name `xml:"INVTRAN"`
|
||||||
FiTId String `xml:"FITID"`
|
FiTID String `xml:"FITID"`
|
||||||
SrvrTId String `xml:"SRVRTID,omitempty"`
|
SrvrTID String `xml:"SRVRTID,omitempty"`
|
||||||
DtTrade Date `xml:"DTTRADE"` // trade date; for stock splits, day of record
|
DtTrade Date `xml:"DTTRADE"` // trade date; for stock splits, day of record
|
||||||
DtSettle *Date `xml:"DTSETTLE,omitempty"` // settlement date; for stock splits, execution date
|
DtSettle *Date `xml:"DTSETTLE,omitempty"` // settlement date; for stock splits, execution date
|
||||||
ReversalFiTId String `xml:"REVERSALFITID,omitempty"` // For a reversal transaction, the FITID of the transaction that is being reversed.
|
ReversalFiTID String `xml:"REVERSALFITID,omitempty"` // For a reversal transaction, the FITID of the transaction that is being reversed.
|
||||||
Memo String `xml:"MEMO,omitempty"`
|
Memo String `xml:"MEMO,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
@ -65,7 +65,7 @@ type InvBuy struct {
|
|||||||
SubAcctFund subAcctType `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 them
|
// 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
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ type InvBuy struct {
|
|||||||
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
|
||||||
@ -94,7 +94,7 @@ type InvSell struct {
|
|||||||
SubAcctSec subAcctType `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 subAcctType `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 withheld due to penalty
|
Penalty Amount `xml:"PENALTY,omitempty"` // Amount withheld due to penalty
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ type BuyMF struct {
|
|||||||
XMLName xml.Name `xml:"BUYMF"`
|
XMLName xml.Name `xml:"BUYMF"`
|
||||||
InvBuy InvBuy `xml:"INVBUY"`
|
InvBuy InvBuy `xml:"INVBUY"`
|
||||||
BuyType buyType `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
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t BuyMF) TransactionType() string {
|
func (t BuyMF) TransactionType() string {
|
||||||
@ -155,12 +155,12 @@ 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 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
|
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 subAcctType `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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ func (t ClosureOpt) TransactionType() string {
|
|||||||
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 incomeType `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 subAcctType `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
|
||||||
@ -192,7 +192,7 @@ func (t Income) TransactionType() string {
|
|||||||
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 subAcctType `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 subAcctType `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
|
||||||
@ -222,7 +222,7 @@ func (t JrnlFund) TransactionType() string {
|
|||||||
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 subAcctType `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 subAcctType `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
|
||||||
@ -249,7 +249,7 @@ func (t MarginInterest) TransactionType() string {
|
|||||||
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 incomeType `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 subAcctType `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
|
||||||
@ -272,7 +272,7 @@ 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 subAcctType `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 subAcctType `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
|
||||||
@ -301,7 +301,7 @@ type SellMF struct {
|
|||||||
InvSell InvSell `xml:"INVSELL"`
|
InvSell InvSell `xml:"INVSELL"`
|
||||||
SellType sellType `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
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t SellMF) TransactionType() string {
|
func (t SellMF) TransactionType() string {
|
||||||
@ -313,7 +313,7 @@ type SellOpt struct {
|
|||||||
InvSell InvSell `xml:"INVSELL"`
|
InvSell InvSell `xml:"INVSELL"`
|
||||||
OptSellType optSellType `xml:"OPTSELLTYPE"` // For options, type of sell: SELLTOCLOSE, SELLTOOPEN. The SELLTOCLOSE action is selling a previously bought option. The SELLTOOPEN action is writing an option
|
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 relType `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 secured `xml:"SECURED,omitempty"` // NAKED, COVERED
|
Secured secured `xml:"SECURED,omitempty"` // NAKED, COVERED
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ 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 subAcctType `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
|
||||||
@ -364,7 +364,7 @@ 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 subAcctType `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 tferAction `xml:"TFERACTION"` // One of IN, OUT
|
TferAction tferAction `xml:"TFERACTION"` // One of IN, OUT
|
||||||
@ -558,7 +558,7 @@ 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 subAcctType `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 posType `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
|
||||||
@ -690,9 +690,9 @@ 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 subAcctType `xml:"SUBACCT"` // One of CASH, MARGIN, SHORT, OTHER
|
SubAcct subAcctType `xml:"SUBACCT"` // One of CASH, MARGIN, SHORT, OTHER
|
||||||
@ -816,7 +816,7 @@ func (o OOSellStock) OrderType() string {
|
|||||||
type OOSwitchMF struct {
|
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 unitType `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
|
||||||
}
|
}
|
||||||
@ -914,7 +914,7 @@ func (o *OOList) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
|||||||
|
|
||||||
type ContribSecurity struct {
|
type ContribSecurity struct {
|
||||||
XMLName xml.Name `xml:"CONTRIBSECURITY"`
|
XMLName xml.Name `xml:"CONTRIBSECURITY"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
SecID SecurityID `xml:"SECID"`
|
||||||
PreTaxContribPct Amount `xml:"PRETAXCONTRIBPCT,omitempty"` // Percentage of each new employee pretax contribution allocated to this security, rate.
|
PreTaxContribPct Amount `xml:"PRETAXCONTRIBPCT,omitempty"` // Percentage of each new employee pretax contribution allocated to this security, rate.
|
||||||
PreTaxContribAmt Amount `xml:"PRETAXCONTRIBAMT,omitempty"` // Fixed amount of each new employee pretax contribution allocated to this security, amount
|
PreTaxContribAmt Amount `xml:"PRETAXCONTRIBAMT,omitempty"` // Fixed amount of each new employee pretax contribution allocated to this security, amount
|
||||||
AfterTaxContribPct Amount `xml:"AFTERTAXCONTRIBPCT,omitempty"` // Percentage of each new employee after tax contribution allocated to this security, rate.
|
AfterTaxContribPct Amount `xml:"AFTERTAXCONTRIBPCT,omitempty"` // Percentage of each new employee after tax contribution allocated to this security, rate.
|
||||||
|
350
invstmt_test.go
350
invstmt_test.go
@ -50,13 +50,13 @@ func TestMarshalInvStatementRequest(t *testing.T) {
|
|||||||
</OFX>`
|
</OFX>`
|
||||||
|
|
||||||
var client = ofxgo.Client{
|
var client = ofxgo.Client{
|
||||||
AppId: "MYAPP",
|
AppID: "MYAPP",
|
||||||
AppVer: "1234",
|
AppVer: "1234",
|
||||||
SpecVersion: "203",
|
SpecVersion: "203",
|
||||||
}
|
}
|
||||||
|
|
||||||
var request ofxgo.Request
|
var request ofxgo.Request
|
||||||
request.Signon.UserId = "1998124"
|
request.Signon.UserID = "1998124"
|
||||||
request.Signon.UserPass = "Sup3eSekrit"
|
request.Signon.UserPass = "Sup3eSekrit"
|
||||||
request.Signon.Org = "First Bank"
|
request.Signon.Org = "First Bank"
|
||||||
request.Signon.Fid = "01"
|
request.Signon.Fid = "01"
|
||||||
@ -66,8 +66,8 @@ func TestMarshalInvStatementRequest(t *testing.T) {
|
|||||||
statementRequest := ofxgo.InvStatementRequest{
|
statementRequest := ofxgo.InvStatementRequest{
|
||||||
TrnUID: "382827d6-e2d0-4396-bf3b-665979285420",
|
TrnUID: "382827d6-e2d0-4396-bf3b-665979285420",
|
||||||
InvAcctFrom: ofxgo.InvAcct{
|
InvAcctFrom: ofxgo.InvAcct{
|
||||||
BrokerId: "fi.example.com",
|
BrokerID: "fi.example.com",
|
||||||
AcctId: "82736664",
|
AcctID: "82736664",
|
||||||
},
|
},
|
||||||
DtStart: ofxgo.NewDate(2016, 1, 1, 0, 0, 0, 0, EST),
|
DtStart: ofxgo.NewDate(2016, 1, 1, 0, 0, 0, 0, EST),
|
||||||
Include: true,
|
Include: true,
|
||||||
@ -344,13 +344,13 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
ofxgo.BuyStock{
|
ofxgo.BuyStock{
|
||||||
InvBuy: ofxgo.InvBuy{
|
InvBuy: ofxgo.InvBuy{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "729483191",
|
FiTID: "729483191",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
DtSettle: ofxgo.NewDateGMT(2017, 2, 7, 0, 0, 0, 0),
|
DtSettle: ofxgo.NewDateGMT(2017, 2, 7, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
Units: units1,
|
Units: units1,
|
||||||
UnitPrice: unitprice1,
|
UnitPrice: unitprice1,
|
||||||
@ -372,7 +372,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
DtAvail: ofxgo.NewDateGMT(2017, 1, 23, 0, 0, 0, 0),
|
DtAvail: ofxgo.NewDateGMT(2017, 1, 23, 0, 0, 0, 0),
|
||||||
|
|
||||||
TrnAmt: amount2,
|
TrnAmt: amount2,
|
||||||
FiTId: "993838",
|
FiTID: "993838",
|
||||||
Name: "DEPOSIT",
|
Name: "DEPOSIT",
|
||||||
Memo: "CHECK 19980",
|
Memo: "CHECK 19980",
|
||||||
},
|
},
|
||||||
@ -426,16 +426,16 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
DtAsOf: *ofxgo.NewDateGMT(2017, 3, 31, 0, 0, 0, 0),
|
DtAsOf: *ofxgo.NewDateGMT(2017, 3, 31, 0, 0, 0, 0),
|
||||||
CurDef: "USD",
|
CurDef: "USD",
|
||||||
InvAcctFrom: ofxgo.InvAcct{
|
InvAcctFrom: ofxgo.InvAcct{
|
||||||
BrokerId: "invstrus.com",
|
BrokerID: "invstrus.com",
|
||||||
AcctId: "91827364",
|
AcctID: "91827364",
|
||||||
},
|
},
|
||||||
InvTranList: &invtranlist,
|
InvTranList: &invtranlist,
|
||||||
InvPosList: ofxgo.PositionList{
|
InvPosList: ofxgo.PositionList{
|
||||||
ofxgo.StockPosition{
|
ofxgo.StockPosition{
|
||||||
InvPos: ofxgo.InvPosition{
|
InvPos: ofxgo.InvPosition{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: ofxgo.PosTypeLong,
|
PosType: ofxgo.PosTypeLong,
|
||||||
@ -448,9 +448,9 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OptPosition{
|
ofxgo.OptPosition{
|
||||||
InvPos: ofxgo.InvPosition{
|
InvPos: ofxgo.InvPosition{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "129887339",
|
UniqueID: "129887339",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: ofxgo.PosTypeLong,
|
PosType: ofxgo.PosTypeLong,
|
||||||
@ -465,10 +465,10 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
InvOOList: ofxgo.OOList{
|
InvOOList: ofxgo.OOList{
|
||||||
ofxgo.OOBuyMF{
|
ofxgo.OOBuyMF{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "76464632",
|
FiTID: "76464632",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "922908645",
|
UniqueID: "922908645",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
|
||||||
Units: oounits1,
|
Units: oounits1,
|
||||||
@ -482,10 +482,10 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OOBuyStock{
|
ofxgo.OOBuyStock{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "999387423",
|
FiTID: "999387423",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422348",
|
UniqueID: "899422348",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||||
Units: oounits2,
|
Units: oounits2,
|
||||||
@ -510,55 +510,55 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
Securities: []ofxgo.Security{
|
Securities: []ofxgo.Security{
|
||||||
ofxgo.StockInfo{
|
ofxgo.StockInfo{
|
||||||
SecInfo: ofxgo.SecInfo{
|
SecInfo: ofxgo.SecInfo{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
SecName: "S&P 500 ETF",
|
SecName: "S&P 500 ETF",
|
||||||
Ticker: "SPY",
|
Ticker: "SPY",
|
||||||
FiId: "99184",
|
FiID: "99184",
|
||||||
},
|
},
|
||||||
Yield: yield1,
|
Yield: yield1,
|
||||||
AssetClass: ofxgo.AssetClassOther,
|
AssetClass: ofxgo.AssetClassOther,
|
||||||
},
|
},
|
||||||
ofxgo.OptInfo{
|
ofxgo.OptInfo{
|
||||||
SecInfo: ofxgo.SecInfo{
|
SecInfo: ofxgo.SecInfo{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "129887339",
|
UniqueID: "129887339",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
SecName: "John's Fertilizer Puts",
|
SecName: "John's Fertilizer Puts",
|
||||||
Ticker: "FERTP",
|
Ticker: "FERTP",
|
||||||
FiId: "882919",
|
FiID: "882919",
|
||||||
},
|
},
|
||||||
OptType: ofxgo.OptTypePut,
|
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,
|
||||||
SecId: &ofxgo.SecurityId{
|
SecID: &ofxgo.SecurityID{
|
||||||
UniqueId: "983322180",
|
UniqueID: "983322180",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
AssetClass: ofxgo.AssetClassLargeStock,
|
AssetClass: ofxgo.AssetClassLargeStock,
|
||||||
},
|
},
|
||||||
ofxgo.StockInfo{
|
ofxgo.StockInfo{
|
||||||
SecInfo: ofxgo.SecInfo{
|
SecInfo: ofxgo.SecInfo{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422348",
|
UniqueID: "899422348",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
SecName: "Whatchamacallit, Inc.",
|
SecName: "Whatchamacallit, Inc.",
|
||||||
Ticker: "WHAT",
|
Ticker: "WHAT",
|
||||||
FiId: "883897",
|
FiID: "883897",
|
||||||
},
|
},
|
||||||
Yield: yield2,
|
Yield: yield2,
|
||||||
AssetClass: ofxgo.AssetClassSmallStock,
|
AssetClass: ofxgo.AssetClassSmallStock,
|
||||||
},
|
},
|
||||||
ofxgo.MFInfo{
|
ofxgo.MFInfo{
|
||||||
SecInfo: ofxgo.SecInfo{
|
SecInfo: ofxgo.SecInfo{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "922908645",
|
UniqueID: "922908645",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
SecName: "Mid-Cap Index Fund Admiral Shares",
|
SecName: "Mid-Cap Index Fund Admiral Shares",
|
||||||
Ticker: "VIMAX",
|
Ticker: "VIMAX",
|
||||||
@ -566,9 +566,9 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.DebtInfo{
|
ofxgo.DebtInfo{
|
||||||
SecInfo: ofxgo.SecInfo{
|
SecInfo: ofxgo.SecInfo{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "99182828",
|
UniqueID: "99182828",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
SecName: "Someone's Class B Debt",
|
SecName: "Someone's Class B Debt",
|
||||||
},
|
},
|
||||||
@ -579,9 +579,9 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OtherInfo{
|
ofxgo.OtherInfo{
|
||||||
SecInfo: ofxgo.SecInfo{
|
SecInfo: ofxgo.SecInfo{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "88181818",
|
UniqueID: "88181818",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
SecName: "Foo Bar",
|
SecName: "Foo Bar",
|
||||||
},
|
},
|
||||||
@ -790,13 +790,13 @@ NEWFILEUID: NONE
|
|||||||
ofxgo.SellOpt{
|
ofxgo.SellOpt{
|
||||||
InvSell: ofxgo.InvSell{
|
InvSell: ofxgo.InvSell{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "12341234-20161207-1",
|
FiTID: "12341234-20161207-1",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2016, 12, 7, 12, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2016, 12, 7, 12, 0, 0, 0),
|
||||||
DtSettle: ofxgo.NewDateGMT(2016, 12, 8, 12, 0, 0, 0),
|
DtSettle: ofxgo.NewDateGMT(2016, 12, 8, 12, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "SPY161216C00226000",
|
UniqueID: "SPY161216C00226000",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
Units: units1,
|
Units: units1,
|
||||||
UnitPrice: unitprice1,
|
UnitPrice: unitprice1,
|
||||||
@ -811,13 +811,13 @@ NEWFILEUID: NONE
|
|||||||
},
|
},
|
||||||
ofxgo.ClosureOpt{
|
ofxgo.ClosureOpt{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "12341234-20161215-1",
|
FiTID: "12341234-20161215-1",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2016, 12, 15, 12, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2016, 12, 15, 12, 0, 0, 0),
|
||||||
DtSettle: ofxgo.NewDateGMT(2016, 12, 20, 12, 0, 0, 0),
|
DtSettle: ofxgo.NewDateGMT(2016, 12, 20, 12, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F10",
|
UniqueID: "78462F10",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
OptAction: ofxgo.OptActionAssign,
|
OptAction: ofxgo.OptActionAssign,
|
||||||
Units: units2,
|
Units: units2,
|
||||||
@ -826,13 +826,13 @@ NEWFILEUID: NONE
|
|||||||
},
|
},
|
||||||
ofxgo.ClosureOpt{
|
ofxgo.ClosureOpt{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "12341234-20161215-2",
|
FiTID: "12341234-20161215-2",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2016, 12, 15, 12, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2016, 12, 15, 12, 0, 0, 0),
|
||||||
DtSettle: ofxgo.NewDateGMT(2016, 12, 15, 12, 0, 0, 0),
|
DtSettle: ofxgo.NewDateGMT(2016, 12, 15, 12, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "SPY161216C00226000",
|
UniqueID: "SPY161216C00226000",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
OptAction: ofxgo.OptActionAssign,
|
OptAction: ofxgo.OptActionAssign,
|
||||||
Units: units3,
|
Units: units3,
|
||||||
@ -870,16 +870,16 @@ NEWFILEUID: NONE
|
|||||||
DtAsOf: *ofxgo.NewDateGMT(2017, 4, 3, 12, 0, 0, 0),
|
DtAsOf: *ofxgo.NewDateGMT(2017, 4, 3, 12, 0, 0, 0),
|
||||||
CurDef: "USD",
|
CurDef: "USD",
|
||||||
InvAcctFrom: ofxgo.InvAcct{
|
InvAcctFrom: ofxgo.InvAcct{
|
||||||
BrokerId: "www.exampletrader.com",
|
BrokerID: "www.exampletrader.com",
|
||||||
AcctId: "12341234",
|
AcctID: "12341234",
|
||||||
},
|
},
|
||||||
InvTranList: &invtranlist,
|
InvTranList: &invtranlist,
|
||||||
InvPosList: ofxgo.PositionList{
|
InvPosList: ofxgo.PositionList{
|
||||||
ofxgo.StockPosition{
|
ofxgo.StockPosition{
|
||||||
InvPos: ofxgo.InvPosition{
|
InvPos: ofxgo.InvPosition{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "04956010",
|
UniqueID: "04956010",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: ofxgo.PosTypeLong,
|
PosType: ofxgo.PosTypeLong,
|
||||||
@ -891,9 +891,9 @@ NEWFILEUID: NONE
|
|||||||
},
|
},
|
||||||
ofxgo.StockPosition{
|
ofxgo.StockPosition{
|
||||||
InvPos: ofxgo.InvPosition{
|
InvPos: ofxgo.InvPosition{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "36960410",
|
UniqueID: "36960410",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: ofxgo.PosTypeLong,
|
PosType: ofxgo.PosTypeLong,
|
||||||
@ -915,9 +915,9 @@ NEWFILEUID: NONE
|
|||||||
Securities: []ofxgo.Security{
|
Securities: []ofxgo.Security{
|
||||||
ofxgo.StockInfo{
|
ofxgo.StockInfo{
|
||||||
SecInfo: ofxgo.SecInfo{
|
SecInfo: ofxgo.SecInfo{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F10",
|
UniqueID: "78462F10",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
SecName: "SPDR S&P 500 ETF TRUST",
|
SecName: "SPDR S&P 500 ETF TRUST",
|
||||||
Ticker: "SPY",
|
Ticker: "SPY",
|
||||||
@ -925,9 +925,9 @@ NEWFILEUID: NONE
|
|||||||
},
|
},
|
||||||
ofxgo.OptInfo{
|
ofxgo.OptInfo{
|
||||||
SecInfo: ofxgo.SecInfo{
|
SecInfo: ofxgo.SecInfo{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "SPY161216C00226000",
|
UniqueID: "SPY161216C00226000",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
SecName: "SPY Dec 16 2016 226.00 Call",
|
SecName: "SPY Dec 16 2016 226.00 Call",
|
||||||
Ticker: "SPY 161216C00226000",
|
Ticker: "SPY 161216C00226000",
|
||||||
@ -1137,13 +1137,13 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
|||||||
ofxgo.BuyDebt{
|
ofxgo.BuyDebt{
|
||||||
InvBuy: ofxgo.InvBuy{
|
InvBuy: ofxgo.InvBuy{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "81818",
|
FiTID: "81818",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
DtSettle: ofxgo.NewDateGMT(2017, 2, 7, 0, 0, 0, 0),
|
DtSettle: ofxgo.NewDateGMT(2017, 2, 7, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
Units: units1,
|
Units: units1,
|
||||||
UnitPrice: unitprice1,
|
UnitPrice: unitprice1,
|
||||||
@ -1158,13 +1158,13 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
|||||||
ofxgo.BuyOpt{
|
ofxgo.BuyOpt{
|
||||||
InvBuy: ofxgo.InvBuy{
|
InvBuy: ofxgo.InvBuy{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "81818",
|
FiTID: "81818",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
Memo: "Something to make a memo about",
|
Memo: "Something to make a memo about",
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
Units: units1,
|
Units: units1,
|
||||||
UnitPrice: unitprice1,
|
UnitPrice: unitprice1,
|
||||||
@ -1177,12 +1177,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.InvExpense{
|
ofxgo.InvExpense{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "129837-1111",
|
FiTID: "129837-1111",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
Total: fees1,
|
Total: fees1,
|
||||||
SubAcctSec: ofxgo.SubAcctTypeCash,
|
SubAcctSec: ofxgo.SubAcctTypeCash,
|
||||||
@ -1190,12 +1190,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.JrnlSec{
|
ofxgo.JrnlSec{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "129837-1112",
|
FiTID: "129837-1112",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
Units: total2,
|
Units: total2,
|
||||||
SubAcctTo: ofxgo.SubAcctTypeCash,
|
SubAcctTo: ofxgo.SubAcctTypeCash,
|
||||||
@ -1203,7 +1203,7 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.JrnlFund{
|
ofxgo.JrnlFund{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "129837-1112",
|
FiTID: "129837-1112",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
Total: total2,
|
Total: total2,
|
||||||
@ -1213,12 +1213,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
|||||||
ofxgo.BuyOther{
|
ofxgo.BuyOther{
|
||||||
InvBuy: ofxgo.InvBuy{
|
InvBuy: ofxgo.InvBuy{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "81818",
|
FiTID: "81818",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
Units: units1,
|
Units: units1,
|
||||||
UnitPrice: unitprice1,
|
UnitPrice: unitprice1,
|
||||||
@ -1229,7 +1229,7 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.MarginInterest{
|
ofxgo.MarginInterest{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "129837-1112",
|
FiTID: "129837-1112",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
Total: total2,
|
Total: total2,
|
||||||
@ -1238,12 +1238,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
|||||||
ofxgo.SellDebt{
|
ofxgo.SellDebt{
|
||||||
InvSell: ofxgo.InvSell{
|
InvSell: ofxgo.InvSell{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "129837-1111",
|
FiTID: "129837-1111",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
Units: units1,
|
Units: units1,
|
||||||
UnitPrice: unitprice1,
|
UnitPrice: unitprice1,
|
||||||
@ -1255,12 +1255,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.RetOfCap{
|
ofxgo.RetOfCap{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "129837-1111",
|
FiTID: "129837-1111",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
Total: total2,
|
Total: total2,
|
||||||
SubAcctSec: ofxgo.SubAcctTypeCash,
|
SubAcctSec: ofxgo.SubAcctTypeCash,
|
||||||
@ -1268,12 +1268,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.Split{
|
ofxgo.Split{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "129837-1111",
|
FiTID: "129837-1111",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
SubAcctSec: ofxgo.SubAcctTypeCash,
|
SubAcctSec: ofxgo.SubAcctTypeCash,
|
||||||
OldUnits: oldunits1,
|
OldUnits: oldunits1,
|
||||||
@ -1284,12 +1284,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
|||||||
ofxgo.SellOther{
|
ofxgo.SellOther{
|
||||||
InvSell: ofxgo.InvSell{
|
InvSell: ofxgo.InvSell{
|
||||||
InvTran: ofxgo.InvTran{
|
InvTran: ofxgo.InvTran{
|
||||||
FiTId: "129837-1111",
|
FiTID: "129837-1111",
|
||||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
Units: units1,
|
Units: units1,
|
||||||
UnitPrice: unitprice1,
|
UnitPrice: unitprice1,
|
||||||
@ -1399,9 +1399,9 @@ func TestUnmarshalPositionList(t *testing.T) {
|
|||||||
expected := ofxgo.PositionList{
|
expected := ofxgo.PositionList{
|
||||||
ofxgo.OtherPosition{
|
ofxgo.OtherPosition{
|
||||||
InvPos: ofxgo.InvPosition{
|
InvPos: ofxgo.InvPosition{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: ofxgo.PosTypeLong,
|
PosType: ofxgo.PosTypeLong,
|
||||||
@ -1413,9 +1413,9 @@ func TestUnmarshalPositionList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.StockPosition{
|
ofxgo.StockPosition{
|
||||||
InvPos: ofxgo.InvPosition{
|
InvPos: ofxgo.InvPosition{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: ofxgo.PosTypeShort,
|
PosType: ofxgo.PosTypeShort,
|
||||||
@ -1429,9 +1429,9 @@ func TestUnmarshalPositionList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.DebtPosition{
|
ofxgo.DebtPosition{
|
||||||
InvPos: ofxgo.InvPosition{
|
InvPos: ofxgo.InvPosition{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "129887339",
|
UniqueID: "129887339",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: ofxgo.PosTypeLong,
|
PosType: ofxgo.PosTypeLong,
|
||||||
@ -1443,9 +1443,9 @@ func TestUnmarshalPositionList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OptPosition{
|
ofxgo.OptPosition{
|
||||||
InvPos: ofxgo.InvPosition{
|
InvPos: ofxgo.InvPosition{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "129887339",
|
UniqueID: "129887339",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: ofxgo.PosTypeLong,
|
PosType: ofxgo.PosTypeLong,
|
||||||
@ -1457,9 +1457,9 @@ func TestUnmarshalPositionList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.MFPosition{
|
ofxgo.MFPosition{
|
||||||
InvPos: ofxgo.InvPosition{
|
InvPos: ofxgo.InvPosition{
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "78462F103",
|
UniqueID: "78462F103",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||||
PosType: ofxgo.PosTypeLong,
|
PosType: ofxgo.PosTypeLong,
|
||||||
@ -1672,10 +1672,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
expected := ofxgo.OOList{
|
expected := ofxgo.OOList{
|
||||||
ofxgo.OOBuyDebt{
|
ofxgo.OOBuyDebt{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "76464632",
|
FiTID: "76464632",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "922908645",
|
UniqueID: "922908645",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
|
||||||
Units: oounits1,
|
Units: oounits1,
|
||||||
@ -1687,10 +1687,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OOBuyMF{
|
ofxgo.OOBuyMF{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "76464632",
|
FiTID: "76464632",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "922908645",
|
UniqueID: "922908645",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
|
||||||
Units: oounits1,
|
Units: oounits1,
|
||||||
@ -1704,10 +1704,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OOBuyOpt{
|
ofxgo.OOBuyOpt{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "999387423",
|
FiTID: "999387423",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422348",
|
UniqueID: "899422348",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||||
Units: oounits2,
|
Units: oounits2,
|
||||||
@ -1720,10 +1720,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OOBuyStock{
|
ofxgo.OOBuyStock{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "999387423",
|
FiTID: "999387423",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422348",
|
UniqueID: "899422348",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||||
Units: oounits2,
|
Units: oounits2,
|
||||||
@ -1736,10 +1736,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OOBuyOther{
|
ofxgo.OOBuyOther{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "999387423",
|
FiTID: "999387423",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422348",
|
UniqueID: "899422348",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||||
Units: oounits2,
|
Units: oounits2,
|
||||||
@ -1752,10 +1752,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OOSellDebt{
|
ofxgo.OOSellDebt{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "999387423",
|
FiTID: "999387423",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422348",
|
UniqueID: "899422348",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||||
Units: oounits2,
|
Units: oounits2,
|
||||||
@ -1766,10 +1766,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OOSellMF{
|
ofxgo.OOSellMF{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "999387423",
|
FiTID: "999387423",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422348",
|
UniqueID: "899422348",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||||
Units: oounits2,
|
Units: oounits2,
|
||||||
@ -1783,10 +1783,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OOSellOpt{
|
ofxgo.OOSellOpt{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "999387423",
|
FiTID: "999387423",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422348",
|
UniqueID: "899422348",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||||
Units: oounits2,
|
Units: oounits2,
|
||||||
@ -1798,10 +1798,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OOSellOther{
|
ofxgo.OOSellOther{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "999387423",
|
FiTID: "999387423",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422348",
|
UniqueID: "899422348",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||||
Units: oounits2,
|
Units: oounits2,
|
||||||
@ -1813,10 +1813,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OOSellStock{
|
ofxgo.OOSellStock{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "999387423",
|
FiTID: "999387423",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422348",
|
UniqueID: "899422348",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||||
Units: oounits2,
|
Units: oounits2,
|
||||||
@ -1828,10 +1828,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ofxgo.OOSwitchMF{
|
ofxgo.OOSwitchMF{
|
||||||
OO: ofxgo.OO{
|
OO: ofxgo.OO{
|
||||||
FiTId: "999387423",
|
FiTID: "999387423",
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422348",
|
UniqueID: "899422348",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||||
Units: oounits2,
|
Units: oounits2,
|
||||||
@ -1839,9 +1839,9 @@ func TestUnmarshalOOList(t *testing.T) {
|
|||||||
Duration: ofxgo.DurationGoodTilCancel,
|
Duration: ofxgo.DurationGoodTilCancel,
|
||||||
Restriction: ofxgo.RestrictionAllOrNone,
|
Restriction: ofxgo.RestrictionAllOrNone,
|
||||||
},
|
},
|
||||||
SecId: ofxgo.SecurityId{
|
SecID: ofxgo.SecurityID{
|
||||||
UniqueId: "899422389",
|
UniqueID: "899422389",
|
||||||
UniqueIdType: "CUSIP",
|
UniqueIDType: "CUSIP",
|
||||||
},
|
},
|
||||||
UnitType: ofxgo.UnitTypeCurrency,
|
UnitType: ofxgo.UnitTypeCurrency,
|
||||||
SwitchAll: false,
|
SwitchAll: false,
|
||||||
|
@ -37,13 +37,13 @@ func TestMarshalProfileRequest(t *testing.T) {
|
|||||||
</OFX>`
|
</OFX>`
|
||||||
|
|
||||||
var client = ofxgo.Client{
|
var client = ofxgo.Client{
|
||||||
AppId: "OFXGO",
|
AppID: "OFXGO",
|
||||||
AppVer: "0001",
|
AppVer: "0001",
|
||||||
SpecVersion: "203",
|
SpecVersion: "203",
|
||||||
}
|
}
|
||||||
|
|
||||||
var request ofxgo.Request
|
var request ofxgo.Request
|
||||||
request.Signon.UserId = "anonymous00000000000000000000000"
|
request.Signon.UserID = "anonymous00000000000000000000000"
|
||||||
request.Signon.UserPass = "anonymous00000000000000000000000"
|
request.Signon.UserPass = "anonymous00000000000000000000000"
|
||||||
request.Signon.Org = "BNK"
|
request.Signon.Org = "BNK"
|
||||||
request.Signon.Fid = "1987"
|
request.Signon.Fid = "1987"
|
||||||
|
@ -66,7 +66,7 @@ func (oq *Request) SetClientFields(c *Client) {
|
|||||||
|
|
||||||
// Overwrite fields that the client controls
|
// Overwrite fields that the client controls
|
||||||
oq.Version = c.OfxVersion()
|
oq.Version = c.OfxVersion()
|
||||||
oq.Signon.AppId = c.Id()
|
oq.Signon.AppID = c.ID()
|
||||||
oq.Signon.AppVer = c.Version()
|
oq.Signon.AppVer = c.Version()
|
||||||
oq.indent = c.IndentRequests()
|
oq.indent = c.IndentRequests()
|
||||||
}
|
}
|
||||||
|
16
seclist.go
16
seclist.go
@ -5,18 +5,18 @@ import (
|
|||||||
"github.com/aclindsa/go/src/encoding/xml"
|
"github.com/aclindsa/go/src/encoding/xml"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SecurityId struct {
|
type SecurityID struct {
|
||||||
XMLName xml.Name `xml:"SECID"`
|
XMLName xml.Name `xml:"SECID"`
|
||||||
UniqueId String `xml:"UNIQUEID"` // CUSIP for US FI's
|
UniqueID String `xml:"UNIQUEID"` // CUSIP for US FI's
|
||||||
UniqueIdType String `xml:"UNIQUEIDTYPE"` // Should always be "CUSIP" for US FI's
|
UniqueIDType String `xml:"UNIQUEIDTYPE"` // Should always be "CUSIP" for US FI's
|
||||||
}
|
}
|
||||||
|
|
||||||
type SecurityRequest struct {
|
type SecurityRequest struct {
|
||||||
XMLName xml.Name `xml:"SECRQ"`
|
XMLName xml.Name `xml:"SECRQ"`
|
||||||
// Only one of the next three should be present
|
// Only one of the next three should be present
|
||||||
SecId *SecurityId `xml:"SECID,omitempty"`
|
SecID *SecurityID `xml:"SECID,omitempty"`
|
||||||
Ticker String `xml:"TICKER,omitempty"`
|
Ticker String `xml:"TICKER,omitempty"`
|
||||||
FiId String `xml:"FIID,omitempty"`
|
FiID String `xml:"FIID,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SecListRequest struct {
|
type SecListRequest struct {
|
||||||
@ -69,10 +69,10 @@ type Security interface {
|
|||||||
|
|
||||||
type SecInfo struct {
|
type SecInfo struct {
|
||||||
XMLName xml.Name `xml:"SECINFO"`
|
XMLName xml.Name `xml:"SECINFO"`
|
||||||
SecId SecurityId `xml:"SECID"`
|
SecID SecurityID `xml:"SECID"`
|
||||||
SecName String `xml:"SECNAME"` // Full name of security
|
SecName String `xml:"SECNAME"` // Full name of security
|
||||||
Ticker String `xml:"TICKER,omitempty"` // Ticker symbol
|
Ticker String `xml:"TICKER,omitempty"` // Ticker symbol
|
||||||
FiId String `xml:"FIID,omitempty"`
|
FiID String `xml:"FIID,omitempty"`
|
||||||
Rating String `xml:"RATING,omitempty"`
|
Rating String `xml:"RATING,omitempty"`
|
||||||
UnitPrice Amount `xml:"UNITPRICE,omitempty"` // Current price, as of DTASOF
|
UnitPrice Amount `xml:"UNITPRICE,omitempty"` // Current price, as of DTASOF
|
||||||
DtAsOf *Date `xml:"DTASOF,omitempty"` // Date UNITPRICE was for
|
DtAsOf *Date `xml:"DTASOF,omitempty"` // Date UNITPRICE was for
|
||||||
@ -136,7 +136,7 @@ type OptInfo struct {
|
|||||||
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 assetClass `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
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,13 @@ import (
|
|||||||
type SignonRequest struct {
|
type SignonRequest struct {
|
||||||
XMLName xml.Name `xml:"SONRQ"`
|
XMLName xml.Name `xml:"SONRQ"`
|
||||||
DtClient Date `xml:"DTCLIENT"` // Current time on client, overwritten in Client.Request()
|
DtClient Date `xml:"DTCLIENT"` // Current time on client, overwritten in Client.Request()
|
||||||
UserId String `xml:"USERID"`
|
UserID String `xml:"USERID"`
|
||||||
UserPass String `xml:"USERPASS,omitempty"`
|
UserPass String `xml:"USERPASS,omitempty"`
|
||||||
UserKey String `xml:"USERKEY,omitempty"`
|
UserKey String `xml:"USERKEY,omitempty"`
|
||||||
Language String `xml:"LANGUAGE"` // Defaults to ENG
|
Language String `xml:"LANGUAGE"` // Defaults to ENG
|
||||||
Org String `xml:"FI>ORG"`
|
Org String `xml:"FI>ORG"`
|
||||||
Fid String `xml:"FI>FID"`
|
Fid String `xml:"FI>FID"`
|
||||||
AppId String `xml:"APPID"` // Overwritten in Client.Request()
|
AppID String `xml:"APPID"` // Overwritten in Client.Request()
|
||||||
AppVer String `xml:"APPVER"` // Overwritten in Client.Request()
|
AppVer String `xml:"APPVER"` // Overwritten in Client.Request()
|
||||||
ClientUID UID `xml:"CLIENTUID,omitempty"`
|
ClientUID UID `xml:"CLIENTUID,omitempty"`
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@ func (r *SignonRequest) Name() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *SignonRequest) Valid() (bool, error) {
|
func (r *SignonRequest) Valid() (bool, error) {
|
||||||
if len(r.UserId) < 1 || len(r.UserId) > 32 {
|
if len(r.UserID) < 1 || len(r.UserID) > 32 {
|
||||||
return false, errors.New("SONRQ>USERID invalid length")
|
return false, errors.New("SONRQ>USERID invalid length")
|
||||||
}
|
}
|
||||||
if (len(r.UserPass) == 0) == (len(r.UserKey) == 0) {
|
if (len(r.UserPass) == 0) == (len(r.UserKey) == 0) {
|
||||||
@ -42,7 +42,7 @@ func (r *SignonRequest) Valid() (bool, error) {
|
|||||||
} else if len(r.Language) != 3 {
|
} else if len(r.Language) != 3 {
|
||||||
return false, fmt.Errorf("SONRQ>LANGUAGE invalid length: \"%s\"\n", r.Language)
|
return false, fmt.Errorf("SONRQ>LANGUAGE invalid length: \"%s\"\n", r.Language)
|
||||||
}
|
}
|
||||||
if len(r.AppId) < 1 || len(r.AppId) > 5 {
|
if len(r.AppID) < 1 || len(r.AppID) > 5 {
|
||||||
return false, errors.New("SONRQ>APPID invalid length")
|
return false, errors.New("SONRQ>APPID invalid length")
|
||||||
}
|
}
|
||||||
if len(r.AppVer) < 1 || len(r.AppVer) > 4 {
|
if len(r.AppVer) < 1 || len(r.AppVer) > 4 {
|
||||||
|
@ -7,13 +7,13 @@ import (
|
|||||||
|
|
||||||
func TestMarshalInvalidSignons(t *testing.T) {
|
func TestMarshalInvalidSignons(t *testing.T) {
|
||||||
var client = ofxgo.Client{
|
var client = ofxgo.Client{
|
||||||
AppId: "OFXGO",
|
AppID: "OFXGO",
|
||||||
AppVer: "0001",
|
AppVer: "0001",
|
||||||
SpecVersion: "203",
|
SpecVersion: "203",
|
||||||
}
|
}
|
||||||
|
|
||||||
var request ofxgo.Request
|
var request ofxgo.Request
|
||||||
request.Signon.UserId = "myusername"
|
request.Signon.UserID = "myusername"
|
||||||
request.Signon.UserPass = "Pa$$word"
|
request.Signon.UserPass = "Pa$$word"
|
||||||
request.Signon.Org = "BNK"
|
request.Signon.Org = "BNK"
|
||||||
request.Signon.Fid = "1987"
|
request.Signon.Fid = "1987"
|
||||||
@ -36,16 +36,16 @@ func TestMarshalInvalidSignons(t *testing.T) {
|
|||||||
t.Fatalf("Unexpected error marshalling signon: %s\n", err)
|
t.Fatalf("Unexpected error marshalling signon: %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
request.Signon.UserId = ""
|
request.Signon.UserID = ""
|
||||||
_, err = request.Marshal()
|
_, err = request.Marshal()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("Expected error due to unspecified UserId\n")
|
t.Fatalf("Expected error due to unspecified UserID\n")
|
||||||
}
|
}
|
||||||
request.Signon.UserId = "lakhgdlsakhgdlkahdglkhsadlkghaslkdghsalkdghalsdhg"
|
request.Signon.UserID = "lakhgdlsakhgdlkahdglkhsadlkghaslkdghsalkdghalsdhg"
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("Expected error due to UserId too long\n")
|
t.Fatalf("Expected error due to UserID too long\n")
|
||||||
}
|
}
|
||||||
request.Signon.UserId = "myusername"
|
request.Signon.UserID = "myusername"
|
||||||
|
|
||||||
request.Signon.UserKey = "adlfahdslkgahdweoihadf98agrha87rghasdf9hawhra2hrkwahhaguhwaoefajkei23hff"
|
request.Signon.UserKey = "adlfahdslkgahdweoihadf98agrha87rghasdf9hawhra2hrkwahhaguhwaoefajkei23hff"
|
||||||
_, err = request.Marshal()
|
_, err = request.Marshal()
|
||||||
@ -78,23 +78,23 @@ func TestMarshalInvalidSignons(t *testing.T) {
|
|||||||
}
|
}
|
||||||
request.Signon.Language = "ENG"
|
request.Signon.Language = "ENG"
|
||||||
|
|
||||||
request.Signon.AppId = ""
|
request.Signon.AppID = ""
|
||||||
_, err = request.Marshal()
|
_, err = request.Marshal()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("Expected error due to missing AppId\n")
|
t.Fatalf("Expected error due to missing AppID\n")
|
||||||
}
|
}
|
||||||
request.SetClientFields(&client)
|
request.SetClientFields(&client)
|
||||||
_, err = request.Marshal()
|
_, err = request.Marshal()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Client expected to set empty AppId: %s\n", err)
|
t.Fatalf("Client expected to set empty AppID: %s\n", err)
|
||||||
}
|
}
|
||||||
client.AppId = "ALKHGDH"
|
client.AppID = "ALKHGDH"
|
||||||
request.SetClientFields(&client)
|
request.SetClientFields(&client)
|
||||||
_, err = request.Marshal()
|
_, err = request.Marshal()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("Expected error due to AppId too long\n")
|
t.Fatalf("Expected error due to AppID too long\n")
|
||||||
}
|
}
|
||||||
client.AppId = "OFXGO"
|
client.AppID = "OFXGO"
|
||||||
|
|
||||||
request.Signon.AppVer = ""
|
request.Signon.AppVer = ""
|
||||||
_, err = request.Marshal()
|
_, err = request.Marshal()
|
||||||
|
@ -38,13 +38,13 @@ func TestMarshalAcctInfoRequest(t *testing.T) {
|
|||||||
EST := time.FixedZone("EST", -5*60*60)
|
EST := time.FixedZone("EST", -5*60*60)
|
||||||
|
|
||||||
var client = ofxgo.Client{
|
var client = ofxgo.Client{
|
||||||
AppId: "OFXGO",
|
AppID: "OFXGO",
|
||||||
AppVer: "0001",
|
AppVer: "0001",
|
||||||
SpecVersion: "203",
|
SpecVersion: "203",
|
||||||
}
|
}
|
||||||
|
|
||||||
var request ofxgo.Request
|
var request ofxgo.Request
|
||||||
request.Signon.UserId = "myusername"
|
request.Signon.UserID = "myusername"
|
||||||
request.Signon.UserPass = "Pa$$word"
|
request.Signon.UserPass = "Pa$$word"
|
||||||
request.Signon.Org = "BNK"
|
request.Signon.Org = "BNK"
|
||||||
request.Signon.Fid = "1987"
|
request.Signon.Fid = "1987"
|
||||||
@ -124,8 +124,8 @@ func TestUnmarshalAcctInfoResponse(t *testing.T) {
|
|||||||
|
|
||||||
bankacctinfo := ofxgo.BankAcctInfo{
|
bankacctinfo := ofxgo.BankAcctInfo{
|
||||||
BankAcctFrom: ofxgo.BankAcct{
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
BankId: "8367556009",
|
BankID: "8367556009",
|
||||||
AcctId: "000999847",
|
AcctID: "000999847",
|
||||||
AcctType: ofxgo.AcctTypeMoneyMrkt,
|
AcctType: ofxgo.AcctTypeMoneyMrkt,
|
||||||
},
|
},
|
||||||
SupTxDl: true,
|
SupTxDl: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user