Compare commits

...

2 Commits

2 changed files with 45 additions and 21 deletions

View File

@ -126,11 +126,21 @@ func (c *AllyApi) MarketClock() (resp MarketClockResponse) {
return
}
func (c *AllyApi) MarketQuotes(symbols ...string) {
/**
Given a list of symbols, return an result struct of quote history
*/
func (c *AllyApi) MarketQuotes(symbols ...string) (resp MarketQuotesResponse) {
v := url.Values{
"symbols": symbols,
}
fmt.Printf("%s\n", c.getWithParameters("market/ext/quotes", v))
c.marshalWithQuery("market/ext/quotes", v, &resp)
return
}
func (c *AllyApi) marshalWithQuery(p string, v url.Values, i interface{}) {
resp := c.getWithParameters(p, v)
_ = xml.Unmarshal(resp, &i)
}
// Why does this work?? wtf??

View File

@ -157,24 +157,38 @@ type MarketQuotesResponse struct {
TODO: Finish this page https://www.ally.com/api/invest/documentation/market-ext-quotes-get-post/
*/
type Quote struct {
XMLName xml.Name `xml:"quote"`
AverageDailyPrice100 float64 `xml:"adp_100"`
AverageDailyPrice200 float64 `xml:"adp_200"`
AverageDailyPrice50 float64 `xml:"adp_50"`
AverageDailyVolume21 float64 `xml:"adv_21"`
AverageDailyVolume30 float64 `xml:"adv_30"`
AverageDailyVolume90 float64 `xml:"adv_90"`
AskPrice float64 `xml:"ask"`
AskTime time.Time `xml:"ask_time"`
AskSize int `xml:"asksz"`
Basis float64 `xml:"basis"`
Beta float64 `xml:"beta"`
Bid float64 `xml:"bid"`
BidTime time.Time `xml:"bid_time"`
BidSize int `xml:"bidsz"`
BidTick int `xml:"bidtick"`
Change float64 `xml:"chg"`
ChangeSign string `xml:"chg_sign"`
ChangeText string `xml:"chg_t"`
Close float64 `xml:"cl"`
XMLName xml.Name `xml:"quote"`
AverageDailyPrice100 float64 `xml:"adp_100"`
AverageDailyPrice200 float64 `xml:"adp_200"`
AverageDailyPrice50 float64 `xml:"adp_50"`
AverageDailyVolume21 float64 `xml:"adv_21"`
AverageDailyVolume30 float64 `xml:"adv_30"`
AverageDailyVolume90 float64 `xml:"adv_90"`
AskPrice float64 `xml:"ask"`
AskTime time.Time `xml:"ask_time"`
AskSize int `xml:"asksz"`
Basis float64 `xml:"basis"`
Beta float64 `xml:"beta"`
Bid float64 `xml:"bid"`
BidTime time.Time `xml:"bid_time"`
BidSize int `xml:"bidsz"`
BidTick int `xml:"bidtick"`
Change float64 `xml:"chg"`
ChangeSign string `xml:"chg_sign"`
ChangeText string `xml:"chg_t"`
Close float64 `xml:"cl"`
Cusip float64 `xml:"cusip"`
Date string `xml:"date"`
Datetime string `xml:"datetime"`
Dividend float64 `xml:"div"`
DividendFrequency string `xml:"divfreq"`
DollarValue float64 `xml:"dollar_value"`
EarningsPerShare float64 `xml:"eps"`
CompanyName string `xml:"name"`
PercentChangeSinceClose float64 `xml:"pchg"`
PriorDayClose float64 `xml:"pcls"`
PriceEarningRatio float64 `xml:"pe"`
PriorDayHigh float64 `xml:"phi"`
PriorDayLow float64 `xml:"plo"`
PriorDayOpen float64 `xml:"popn"`
}