-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpair.go
35 lines (32 loc) · 925 Bytes
/
pair.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
package cryptowatch
import (
"context"
"strings"
)
// PairDetail holds details of a pair.
type PairDetail struct {
ID int `json:"id"`
Symbol string `json:"symbol"`
Base struct {
ID int `json:"id"`
Symbol string `json:"symbol"`
Name string `json:"name"`
Fiat bool `json:"fiat"`
Route string `json:"route"`
} `json:"base"`
Quote struct {
ID int `json:"id"`
Symbol string `json:"symbol"`
Name string `json:"name"`
Fiat bool `json:"fiat"`
Route string `json:"route"`
} `json:"quote"`
Route string `json:"route"`
Markets []Market `json:"markets"`
}
// GetPairDetail returns the detail of a pair.
func (c *Client) GetPairDetail(ctx context.Context, pair string, opts ...Option) (PairDetail, error) {
var as PairDetail
opts = append([]Option{withURL(strings.Join([]string{host, "pairs", pair}, "/"))}, opts...)
return as, c.doRequest(ctx, &as, opts...)
}