Skip to content

Commit a7296c3

Browse files
authored
delist api (#32)
1 parent 9d859e7 commit a7296c3

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

v2/client.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,3 +1060,11 @@ func (c *Client) NewGetEarnAccountSerice() *GetEarnAccountService {
10601060
func (c *Client) NewGetCollateralRateService() *GetCollateralRateService {
10611061
return &GetCollateralRateService{c: c}
10621062
}
1063+
1064+
func (c *Client) NewGetDelistService() *GetDelistService {
1065+
return &GetDelistService{c: c}
1066+
}
1067+
1068+
func (c *Client) NewMarginGetDelistService() *MarginGetDelistService {
1069+
return &MarginGetDelistService{c: c}
1070+
}

v2/delist_service.go

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package binance
2+
3+
import (
4+
"context"
5+
"net/http"
6+
)
7+
8+
type GetDelistService struct {
9+
c *Client
10+
}
11+
12+
// Weight: 50
13+
func (s *GetDelistService) Do(ctx context.Context, opts ...RequestOption) ([]*DelistBatch, error) {
14+
r := &request{
15+
method: http.MethodGet,
16+
endpoint: "/sapi/v1/spot/delist-schedule",
17+
secType: secTypeSigned,
18+
}
19+
data, err := s.c.callAPI(ctx, r, opts...)
20+
if err != nil {
21+
return nil, err
22+
}
23+
24+
var res []*DelistBatch
25+
err = json.Unmarshal(data, &res)
26+
if err != nil {
27+
return nil, err
28+
}
29+
return res, nil
30+
}
31+
32+
type MarginGetDelistService struct {
33+
c *Client
34+
}
35+
36+
type DelistBatch struct {
37+
DelistTime int64 `json:"delistTime"`
38+
Symbols []string `json:"symbols"`
39+
}
40+
41+
// Weight: 100
42+
func (s *MarginGetDelistService) Do(ctx context.Context, opts ...RequestOption) ([]*MarginDelistBatch, error) {
43+
r := &request{
44+
method: http.MethodGet,
45+
endpoint: "/sapi/v1/margin/delist-schedule",
46+
secType: secTypeSigned,
47+
}
48+
data, err := s.c.callAPI(ctx, r, opts...)
49+
if err != nil {
50+
return nil, err
51+
}
52+
53+
var res []*MarginDelistBatch
54+
err = json.Unmarshal(data, &res)
55+
if err != nil {
56+
return nil, err
57+
}
58+
return res, nil
59+
}
60+
61+
type MarginDelistBatch struct {
62+
DelistTime int64 `json:"delistTime"`
63+
CrossMarginAssets []string `json:"crossMarginAssets"`
64+
IsolatedMarginSymbols []string `json:"isolatedMarginSymbols"`
65+
}

0 commit comments

Comments
 (0)