allyinvest/main.go

31 lines
480 B
Go
Raw Normal View History

2019-11-08 04:30:22 +00:00
package main
import (
"encoding/xml"
2019-11-08 04:30:22 +00:00
"fmt"
"io/ioutil"
)
func main() {
// Load our environment variables
var api AllyApi
api.Initialize()
2019-11-08 04:30:22 +00:00
// Set up our HTTP client
resp, err := api.Get("accounts")
2019-11-08 04:30:22 +00:00
defer resp.Body.Close()
b, _ := ioutil.ReadAll(resp.Body)
2019-11-09 03:26:17 +00:00
var acctSummary AllyResponse
err = xml.Unmarshal(b, &acctSummary)
if err != nil {
panic(err)
}
fmt.Printf("%s\n", b)
fmt.Printf("%f\n", acctSummary.Accounts[0].AccountHoldingsInfo.TotalSecurities)
2019-11-08 04:30:22 +00:00
}