Market Clock Response

This commit is contained in:
Jacob Windle 2020-01-19 19:21:32 -05:00
parent 5ab62c3075
commit d2861c2df2
3 changed files with 16 additions and 4 deletions

View File

@ -96,3 +96,9 @@ func (c *AllyApi) AccountHoldings(accountId string) AccountDetailHoldingsRespons
_ = xml.Unmarshal(c.getAndRead(fmt.Sprintf("accounts/%s/holdings", accountId)), &resp) _ = xml.Unmarshal(c.getAndRead(fmt.Sprintf("accounts/%s/holdings", accountId)), &resp)
return resp return resp
} }
func (c *AllyApi) MarketClock() MarketClockResponse {
var resp MarketClockResponse
_ = xml.Unmarshal(c.getAndRead("market/clock"), &resp)
return resp
}

View File

@ -2,7 +2,6 @@ package main
import ( import (
"fmt" "fmt"
"strconv"
) )
func main() { func main() {
@ -10,7 +9,5 @@ func main() {
var api AllyApi var api AllyApi
api.Initialize() api.Initialize()
acctId, _ := strconv.Atoi(api.Accounts()[0].Account) fmt.Printf("Market Clock: %d\n", api.MarketClock().UnixTime)
fmt.Printf("AccountDetail: %s\n", api.AccountDetail(acctId).AccountHoldings.Holding[0].Displaydata.Change)
} }

View File

@ -2,6 +2,7 @@ package main
import ( import (
"encoding/xml" "encoding/xml"
"time"
) )
type Accountbalance struct { type Accountbalance struct {
@ -138,3 +139,11 @@ type AccountDetailHoldingsResponse struct {
XMLName xml.Name `xml:"response"` XMLName xml.Name `xml:"response"`
AccountHoldings Accountholdings `xml:"accountholdings"` 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"`
}