-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tickers.go
51 lines (39 loc) · 1014 Bytes
/
tickers.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
48
49
50
51
package wazirx_client
import (
"context"
"encoding/json"
"net/http"
api "github.com/yuvan11/wazirx-go/wazirx-client/endpoints"
)
type TickersService struct {
C *Client
}
type Tickers struct {
Symbol string `json:"symbol"`
BaseAsset string `json:"baseAsset"`
QuoteAsset string `json:"quoteAsset"`
OpenPrice string `json:"openPrice"`
LowPrice string `json:"lowPrice"`
HighPrice string `json:"highPrice"`
LastPrice string `json:"lastPrice"`
Volume string `json:"volume"`
BidPrice string `json:"bidPrice"`
AskPrice string `json:"askPrice"`
At int64 `json:"at"`
}
func (s *TickersService) DisplayTickersData(ctx context.Context) (*[]Tickers, error) {
r := &Request{
Method: http.MethodGet,
Endpoint: api.TICKERS,
SecType: SecTypeNone,
}
data, err := s.C.HandleAPI(ctx, r)
if err != nil {
return &[]Tickers{}, err
}
result := new([]Tickers)
if err := json.Unmarshal(data, &result); err != nil {
return &[]Tickers{}, err
}
return result, nil
}