This repository has been archived by the owner on Feb 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathpricemultifull.go
63 lines (47 loc) · 1.63 KB
/
pricemultifull.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
52
53
54
55
56
57
58
59
60
61
62
63
package cryptocomparego
import (
"net/http"
"github.com/lucazulian/cryptocomparego/context"
)
const (
pricemultifullBasePath = "data/pricemultifull"
)
// Get all the current trading info (price, vol, open, high, low etc) of any list of cryptocurrencies in any other currency that you need.
// If the crypto does not trade directly into the toSymbol requested, BTC will be used for conversion.
// This API also returns Display values for all the fields.If the oposite pair trades we invert it (eg.: BTC-XMR)".
type PriceMultiFullService interface {
List(context.Context, *PriceMultiRequest) ([]PriceMultiFull, *Response, error)
}
type PriceMultiFullServiceOp struct {
client *Client
}
type PriceFull struct {
Type string `json:"TYPE"`
}
type PriceMultiFullAgg struct {
Agg map[string]PriceFull
}
type PriceMultiFull struct {
Raw map[string]map[string]PriceMultiFullAgg `json:"RAW"`
Display map[string]map[string]PriceMultiFullAgg `json:"DISPLAY"`
}
var _ PriceMultiFullService = &PriceMultiFullServiceOp{}
func NewPriceMultiFullRequest(fsyms []string, tsyms []string) *PriceMultiRequest {
pr := PriceMultiRequest{Fsyms: fsyms, Tsyms: tsyms}
pr.E = "CCCAGG"
pr.Sign = false
pr.TryConversion = true
return &pr
}
func (s *PriceMultiFullServiceOp) List(ctx context.Context, priceMultiRequest *PriceMultiRequest) ([]PriceMultiFull, *Response, error) {
path := pricemultifullBasePath
if priceMultiRequest != nil {
path = priceMultiRequest.FormattedQueryString(pricemultiBasePath)
}
req, err := s.client.NewRequest(ctx, http.MethodGet, *s.client.MinURL, path, nil)
if err != nil {
return nil, nil, err
}
_ = req
return nil, nil, nil
}