Finishing up securities structure.

This commit is contained in:
Jacob Windle 2019-11-14 21:24:21 -05:00
parent 42983aedfb
commit a040ec61ec
2 changed files with 26 additions and 2 deletions

View File

@ -49,5 +49,5 @@ func main() {
} }
fmt.Printf("%s\n", b) fmt.Printf("%s\n", b)
fmt.Printf("%s\n", acctSummary.Accounts[0].Balance.Money.AccruedInterest) fmt.Printf("%f\n", acctSummary.Accounts[0].Balance.Securities.LongStocks)
} }

View File

@ -3,7 +3,7 @@ package main
import "encoding/xml" import "encoding/xml"
/** /**
Our Response structure from ALLY Response structure from Ally
*/ */
type AllyResponse struct { type AllyResponse struct {
XMLName xml.Name `xml:"response"` XMLName xml.Name `xml:"response"`
@ -13,9 +13,15 @@ type AllyResponse struct {
Accounts []AccountSummary `xml:"accounts>accountsummary"` Accounts []AccountSummary `xml:"accounts>accountsummary"`
} }
/**
TODO: We need to work on AccountHoldings next.
*/
type AccountHoldings struct { type AccountHoldings struct {
} }
/**
Account summary information
*/
type AccountSummary struct { type AccountSummary struct {
XMLName xml.Name `xml:"accountsummary"` XMLName xml.Name `xml:"accountsummary"`
Account int `xml:"account"` Account int `xml:"account"`
@ -24,9 +30,21 @@ type AccountSummary struct {
Holdings AccountHoldings `xml:"accountholdings"` Holdings AccountHoldings `xml:"accountholdings"`
} }
/**
Different securites currently held with an account
*/
type Securities struct { type Securities struct {
XMLName xml.Name `xml:"securities"`
LongOptions float64 `xml:"longoptions"`
LongStocks float64 `xml:"longstocks"`
Options float64 `xml:"options"`
ShortOptions float64 `xml:"shortoptions"`
ShortStocks float64 `xml:"shortstocks"`
} }
/**
Various values representing account balance
*/
type AccountBalance struct { type AccountBalance struct {
XMLName xml.Name `xml:"accountbalance"` XMLName xml.Name `xml:"accountbalance"`
Account int `xml:"account"` Account int `xml:"account"`
@ -38,6 +56,9 @@ type AccountBalance struct {
Securities Securities `xml:"securities"` Securities Securities `xml:"securities"`
} }
/**
Various values representing buying power of this account
*/
type BuyingPower struct { type BuyingPower struct {
XMLName xml.Name `xml:"buyingpower"` XMLName xml.Name `xml:"buyingpower"`
CashAvailableForWithdrawal float64 `xml:"cashavailableforwithdrawal"` CashAvailableForWithdrawal float64 `xml:"cashavailableforwithdrawal"`
@ -50,6 +71,9 @@ type BuyingPower struct {
Stock int `xml:"stock"` Stock int `xml:"stock"`
} }
/**
Various values representing money in this account
*/
type Money struct { type Money struct {
XMLName xml.Name `xml:"money"` XMLName xml.Name `xml:"money"`
AccruedInterest float64 `xml:"accruedinterest"` AccruedInterest float64 `xml:"accruedinterest"`