-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathticker.go
39 lines (36 loc) · 1.18 KB
/
ticker.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
package btcturk
import "fmt"
// https://docs.btcturk.com/#ticker
type Ticker struct {
Pair string `json:"pair"`
PairNormalized string `json:"pairNormalized"`
Timestamp float64 `json:"timestamp"`
Last float64 `json:"last"`
High float64 `json:"high"`
Low float64 `json:"low"`
Bid float64 `json:"bid"`
Ask float64 `json:"ask"`
Open float64 `json:"open"`
Volume float64 `json:"volume"`
Average float64 `json:"average"`
Daily float64 `json:"daily"`
DailyPercent float64 `json:"dailyPercent"`
DenominatorSymbol string `json:"denominatorSymbol"`
NumeratorSymbol string `json:"numeratorSymbol"`
}
// If pairSymbol is not set, ticker for all pairs will be returned in a json array.
// Or
// GET ?pairSymbol=BTC_TRY
// Or
// GET ?symbol=USDT
func (c *Client) Ticker() ([]Ticker, error) {
req, err := c.newRequest("GET", fmt.Sprintf("/api/v2/ticker?%s", c.params.Encode()), nil)
if err != nil {
return []Ticker{}, err
}
var response []Ticker
if _, err = c.do(req, &response); err != nil {
return []Ticker{}, err
}
return response, nil
}