-
Notifications
You must be signed in to change notification settings - Fork 1
/
trade_fee_service.go
50 lines (43 loc) · 1.03 KB
/
trade_fee_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
48
49
50
package binance
import (
"context"
"encoding/json"
"net/http"
)
// TradeFeeService shows current trade fee for all symbols available
type TradeFeeService struct {
c *Client
symbol *string
}
// Symbol set the symbol parameter for the request
func (s *TradeFeeService) Symbol(symbol string) *TradeFeeService {
s.symbol = &symbol
return s
}
// Do send request
func (s *TradeFeeService) Do(ctx context.Context) (res []*TradeFeeDetails, err error) {
r := &request{
method: http.MethodGet,
endpoint: "/sapi/v1/asset/tradeFee",
secType: secTypeSigned,
}
if s.symbol != nil {
r.setParam("symbol", *s.symbol)
}
data, err := s.c.callAPI(ctx, r)
if err != nil {
return res, err
}
res = make([]*TradeFeeDetails, 0)
err = json.Unmarshal(data, &res)
if err != nil {
return nil, err
}
return res, nil
}
// TradeFeeDetails represents details about fees
type TradeFeeDetails struct {
Symbol string `json:"symbol"`
MakerCommission string `json:"makerCommission"`
TakerCommission string `json:"takerCommission"`
}