Finished balance and holdings calls, onto history!!!

This commit is contained in:
Jacob Windle 2019-11-27 08:39:26 -05:00
parent e2479704f2
commit 5ab62c3075
2 changed files with 24 additions and 2 deletions

View File

@ -79,8 +79,20 @@ func (c *AllyApi) AccountBalances() (balances []AccountBalance) {
return resp.AccountBalances return resp.AccountBalances
} }
func (c *AllyApi) AccountDetail(accountId int) AccountDetailResponse { func (c *AllyApi) AccountDetail(accountId string) AccountDetailResponse {
var resp AccountDetailResponse var resp AccountDetailResponse
_ = xml.Unmarshal(c.getAndRead(fmt.Sprintf("accounts/%d", accountId)), &resp) _ = xml.Unmarshal(c.getAndRead(fmt.Sprintf("accounts/%s", accountId)), &resp)
return resp
}
func (c *AllyApi) AccountBalance(accountId string) AccountDetailBalanceResponse {
var resp AccountDetailBalanceResponse
_ = xml.Unmarshal(c.getAndRead(fmt.Sprintf("accounts/%s/balances", accountId)), &resp)
return resp
}
func (c *AllyApi) AccountHoldings(accountId string) AccountDetailHoldingsResponse {
var resp AccountDetailHoldingsResponse
_ = xml.Unmarshal(c.getAndRead(fmt.Sprintf("accounts/%s/holdings", accountId)), &resp)
return resp return resp
} }

View File

@ -128,3 +128,13 @@ type AccountDetailResponse struct {
AccountBalance Accountbalance `xml:"accountbalance"` AccountBalance Accountbalance `xml:"accountbalance"`
AccountHoldings Accountholdings `xml:"accountholdings"` AccountHoldings Accountholdings `xml:"accountholdings"`
} }
type AccountDetailBalanceResponse struct {
XMLName xml.Name `xml:"response"`
AccountBalance Accountbalance `xml:"accountbalance"`
}
type AccountDetailHoldingsResponse struct {
XMLName xml.Name `xml:"response"`
AccountHoldings Accountholdings `xml:"accountholdings"`
}