Market Clock Response
This commit is contained in:
parent
5ab62c3075
commit
d2861c2df2
@ -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
|
||||
}
|
||||
|
5
main.go
5
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)
|
||||
}
|
||||
|
9
types.go
9
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"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user