/
models.go
47 lines (40 loc) · 1.13 KB
/
models.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package polygon
type APIResponse struct {
Ticker string `json:"ticker"`
Status string `json:"status"`
RequestID string `json:"request_id"`
}
// Aggregate is a rollup of trades for a specified time window.
type Aggregate struct {
Ticker string `json:"T"`
Timestamp int64 `json:"t"`
Volume float64 `json:"v"`
Close float64 `json:"c"`
Open float64 `json:"o"`
High float64 `json:"h"`
Low float64 `json:"l"`
}
// Trade is an executed trade reported to exchanges or TRFs.
type Trade struct {
Price float64 `json:"p"`
}
// AggsResponse contains multiple Aggregates in the results block.
type AggsResponse struct {
APIResponse
Results []*Aggregate `json:"results"`
}
// LastTrade is the last trade that has occurred for this ticker.
type LastTrade struct {
APIResponse
Results Trade `json:"results"`
}
// CompanyDetails returns the meta data about this company.
type CompanyDetails struct {
APIResponse
Results Company `json:"results"`
}
// Company is the meta data about a company.
type Company struct {
CompanyName string `json:"name"`
OutstandingShares int64 `json:"outstanding_shares"`
}