forked from adshao/go-binance
/
commission_rate_service.go
47 lines (42 loc) · 1003 Bytes
/
commission_rate_service.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
package futures
import (
"context"
"encoding/json"
"net/http"
)
type CommissionRateService struct {
c *Client
symbol string
}
// Symbol set symbol
func (service *CommissionRateService) Symbol(symbol string) *CommissionRateService {
service.symbol = symbol
return service
}
// Do send request
func (s *CommissionRateService) Do(ctx context.Context, opts ...RequestOption) (res *CommissionRate, err error) {
r := &request{
method: http.MethodGet,
endpoint: "/fapi/v1/commissionRate",
secType: secTypeSigned,
}
if s.symbol != "" {
r.setParam("symbol", s.symbol)
}
data, _, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return nil, err
}
res = new(CommissionRate)
err = json.Unmarshal(data, &res)
if err != nil {
return nil, err
}
return res, nil
}
// Commission Rate
type CommissionRate struct {
Symbol string `json:"symbol"`
MakerCommissionRate string `json:"makerCommissionRate"`
TakerCommissionRate string `json:"takerCommissionRate"`
}