diff --git a/client.go b/client.go index e0caad5..531a17b 100644 --- a/client.go +++ b/client.go @@ -96,3 +96,9 @@ func (c *AllyApi) AccountHoldings(accountId string) AccountDetailHoldingsRespons _ = xml.Unmarshal(c.getAndRead(fmt.Sprintf("accounts/%s/holdings", accountId)), &resp) return resp } + +func (c *AllyApi) MarketClock() MarketClockResponse { + var resp MarketClockResponse + _ = xml.Unmarshal(c.getAndRead("market/clock"), &resp) + return resp +} diff --git a/main.go b/main.go index b9c8146..97ba7ac 100644 --- a/main.go +++ b/main.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "strconv" ) func main() { @@ -10,7 +9,5 @@ func main() { var api AllyApi api.Initialize() - acctId, _ := strconv.Atoi(api.Accounts()[0].Account) - - fmt.Printf("AccountDetail: %s\n", api.AccountDetail(acctId).AccountHoldings.Holding[0].Displaydata.Change) + fmt.Printf("Market Clock: %d\n", api.MarketClock().UnixTime) } diff --git a/types.go b/types.go index 0185dd5..5194ac4 100644 --- a/types.go +++ b/types.go @@ -2,6 +2,7 @@ package main import ( "encoding/xml" + "time" ) type Accountbalance struct { @@ -138,3 +139,11 @@ type AccountDetailHoldingsResponse struct { XMLName xml.Name `xml:"response"` AccountHoldings Accountholdings `xml:"accountholdings"` } + +type MarketClockResponse struct { + XMLName xml.Name `xml:"response"` + Date string `xml:"date"` + CurrentStatus string `xml:"status>current"` + Message string `xml:"message"` + UnixTime time.Time `xml:"unixtime"` +}