-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintraday.go
More file actions
35 lines (30 loc) · 1.04 KB
/
Copy pathintraday.go
File metadata and controls
35 lines (30 loc) · 1.04 KB
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
package marketstack
import "context"
type IntradayOptions struct {
Symbols []string `url:"symbols,omitempty,comma"`
Exchange string `url:"exchange,omitempty"`
Sort string `url:"sort,omitempty"`
DateFrom string `url:"date_from,omitempty"`
DateTo string `url:"date_to,omitempty"`
Limit int `url:"limit,omitempty"`
Offset int `url:"offset,omitempty"`
Interval string `url:"interval,omitempty"`
}
type IntradayResponse struct {
Pagination Pagination `json:"pagination"`
Data []IntradayData `json:"data"`
}
func (c *Client) GetIntraday(ctx context.Context, opts *IntradayOptions) (*IntradayResponse, error) {
var result IntradayResponse
if err := c.doRequest(ctx, "/intraday", opts, &result); err != nil {
return nil, err
}
return &result, nil
}
func (c *Client) GetIntradayLatest(ctx context.Context, opts *IntradayOptions) (*IntradayResponse, error) {
var result IntradayResponse
if err := c.doRequest(ctx, "/intraday/latest", opts, &result); err != nil {
return nil, err
}
return &result, nil
}