-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ticker.go
54 lines (42 loc) · 1.25 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package ticker
import (
"net/http"
"github.com/go-numb/go-exchanges/api/bitflyer/v1/types"
"github.com/google/go-querystring/query"
)
const PATH = "/v1/getticker"
type Request struct {
ProductCode types.ProductCode `json:"product_code" url:"product_code"`
}
func New(product types.ProductCode) *Request {
return &Request{
ProductCode: product,
}
}
func (p *Request) Path() string {
return PATH
}
func (p *Request) Method() string {
return http.MethodGet
}
func (p *Request) Query() string {
v, _ := query.Values(p)
return v.Encode()
}
func (p *Request) Payload() []byte {
return nil
}
type Response struct {
ProductCode types.ProductCode `json:"product_code"`
LTP float64 `json:"ltp"`
BestBid float64 `json:"best_bid"`
BestAsk float64 `json:"best_ask"`
BestBidSize float64 `json:"best_bid_size"`
BestAskSize float64 `json:"best_ask_size"`
TotalBidDepth float64 `json:"total_bid_depth"`
TotalAskDepth float64 `json:"total_ask_depth"`
Volume float64 `json:"volume"`
VolumeByProduct float64 `json:"volume_by_product"`
Timestamp types.ExchangeTime `json:"timestamp"`
TickID int `json:"tick_id"`
}