From a040ec61ec902cf6242487044932b2f0ee0fbf4e Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 14 Nov 2019 21:24:21 -0500 Subject: [PATCH] Finishing up securities structure. --- main.go | 2 +- types.go | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index d47769c..d6fce3d 100644 --- a/main.go +++ b/main.go @@ -49,5 +49,5 @@ func main() { } 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) } diff --git a/types.go b/types.go index f386e32..511df3f 100644 --- a/types.go +++ b/types.go @@ -3,7 +3,7 @@ package main import "encoding/xml" /** -Our Response structure from ALLY +Response structure from Ally */ type AllyResponse struct { XMLName xml.Name `xml:"response"` @@ -13,9 +13,15 @@ type AllyResponse struct { Accounts []AccountSummary `xml:"accounts>accountsummary"` } +/** +TODO: We need to work on AccountHoldings next. +*/ type AccountHoldings struct { } +/** +Account summary information +*/ type AccountSummary struct { XMLName xml.Name `xml:"accountsummary"` Account int `xml:"account"` @@ -24,9 +30,21 @@ type AccountSummary struct { Holdings AccountHoldings `xml:"accountholdings"` } +/** +Different securites currently held with an account +*/ 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 { XMLName xml.Name `xml:"accountbalance"` Account int `xml:"account"` @@ -38,6 +56,9 @@ type AccountBalance struct { Securities Securities `xml:"securities"` } +/** +Various values representing buying power of this account +*/ type BuyingPower struct { XMLName xml.Name `xml:"buyingpower"` CashAvailableForWithdrawal float64 `xml:"cashavailableforwithdrawal"` @@ -50,6 +71,9 @@ type BuyingPower struct { Stock int `xml:"stock"` } +/** +Various values representing money in this account +*/ type Money struct { XMLName xml.Name `xml:"money"` AccruedInterest float64 `xml:"accruedinterest"`