-
Notifications
You must be signed in to change notification settings - Fork 0
/
signals.go
42 lines (36 loc) · 930 Bytes
/
signals.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
package gorte
import (
"net/http"
"time"
"github.com/dhia-gharsallaoui/gorte/utils"
)
type SignalValue struct {
StartDate time.Time `json:"start_date"`
EndDate time.Time `json:"end_date"`
Value bool `json:"value"`
UpdatedDate time.Time `json:"updated_date"`
}
type Signal []struct {
StartDate time.Time `json:"start_date"`
EndDate time.Time `json:"end_date"`
Type string `json:"type"`
Values []SignalValue `json:"values"`
}
type SignalResp struct {
Signal `json:"signals"`
}
func (s *market) GetSignal(opt utils.Period) (*SignalResp, *http.Response, error) {
c := s.client
req, err := c.NewRequest(http.MethodGet, "open_api/signal/v1/signals", opt)
if err != nil {
c.logger.Err(err.Error())
return nil, nil, err
}
sig := &SignalResp{}
resp, err := c.Do(req, sig)
if err != nil {
c.logger.Err(err.Error())
return nil, resp, err
}
return sig, resp, err
}