-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathfundamentals.go
29 lines (26 loc) · 997 Bytes
/
fundamentals.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package robinhood
import (
"context"
"strings"
)
type Fundamental struct {
Open float64 `json:"open,string"`
High float64 `json:"high,string"`
Low float64 `json:"low,string"`
Volume float64 `json:"volume,string"`
AverageVolume float64 `json:"average_volume,string"`
High52Weeks float64 `json:"high_52_weeks,string"`
DividendYield float64 `json:"dividend_yield,string"`
Low52Weeks float64 `json:"low_52_weeks,string"`
MarketCap float64 `json:"market_cap,string"`
PERatio float64 `json:"pe_ratio,string"`
Description string `json:"description"`
Instrument string `json:"instrument"`
}
// GetFundamentals returns fundamental data for the list of stocks provided.
func (c *Client) GetFundamentals(ctx context.Context, stocks ...string) ([]Fundamental, error) {
url := EPFundamentals + "?symbols=" + strings.Join(stocks, ",")
var r struct{ Results []Fundamental }
err := c.GetAndDecode(ctx, url, &r)
return r.Results, err
}