forked from adshao/go-binance
-
Notifications
You must be signed in to change notification settings - Fork 1
/
asset_detail_service.go
51 lines (46 loc) · 1.17 KB
/
asset_detail_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
51
package binance
import (
"context"
"encoding/json"
)
// GetAssetDetailService fetches all asset detail.
//
// See https://binance-docs.github.io/apidocs/spot/en/#asset-detail-user_data
type GetAssetDetailService struct {
c *Client
asset *string
}
// Asset sets the asset parameter.
func (s *GetAssetDetailService) Asset(asset string) *GetAssetDetailService {
s.asset = &asset
return s
}
// Do sends the request.
func (s *GetAssetDetailService) Do(ctx context.Context) (res map[string]AssetDetail, err error) {
r := &request{
method: "GET",
endpoint: "/sapi/v1/asset/assetDetail",
secType: secTypeSigned,
}
if s.asset != nil {
r.setParam("asset", *s.asset)
}
data, err := s.c.callAPI(ctx, r)
if err != nil {
return
}
res = make(map[string]AssetDetail)
err = json.Unmarshal(data, &res)
if err != nil {
return
}
return res, nil
}
// AssetDetail represents the detail of an asset
type AssetDetail struct {
MinWithdrawAmount float64 `json:"minWithdrawAmount"`
DepositStatus bool `json:"depositStatus"`
WithdrawFee float64 `json:"withdrawFee"`
WithdrawStatus bool `json:"withdrawStatus"`
DepositTip string `json:"depositTip"`
}