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)
|
_ = 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
|
||||||
|
}
|
||||||
|
5
main.go
5
main.go
@ -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)
|
|
||||||
}
|
}
|
||||||
|
9
types.go
9
types.go
@ -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"`
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user