Skip to content

Commit 8c47bc1

Browse files
authored
add fundingInfo api (#35)
1 parent 6b985af commit 8c47bc1

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

v2/futures/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,10 @@ func (c *Client) NewFundingRateService() *FundingRateService {
546546
return &FundingRateService{c: c}
547547
}
548548

549+
func (c *Client) NewFundingInfoService() *FundingInfoService {
550+
return &FundingInfoService{c: c}
551+
}
552+
549553
// NewListUserLiquidationOrdersService init list user's liquidation orders service
550554
func (c *Client) NewListUserLiquidationOrdersService() *ListUserLiquidationOrdersService {
551555
return &ListUserLiquidationOrdersService{c: c}

v2/futures/mark_price.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,36 @@ type FundingRate struct {
125125
MarkPrice string `json:"markPrice"`
126126
}
127127

128+
type FundingInfoService struct {
129+
c *Client
130+
}
131+
132+
// Do send request
133+
func (s *FundingInfoService) Do(ctx context.Context, opts ...RequestOption) (res []*FundingInfo, err error) {
134+
r := &request{
135+
method: http.MethodGet,
136+
endpoint: "/fapi/v1/fundingInfo",
137+
secType: secTypeNone,
138+
}
139+
data, _, err := s.c.callAPI(ctx, r, opts...)
140+
if err != nil {
141+
return []*FundingInfo{}, err
142+
}
143+
res = make([]*FundingInfo, 0)
144+
err = json.Unmarshal(data, &res)
145+
if err != nil {
146+
return []*FundingInfo{}, err
147+
}
148+
return res, nil
149+
}
150+
151+
type FundingInfo struct {
152+
Symbol string `json:"symbol"`
153+
AdjustedFundingRateCap string `json:"adjustedFundingRateCap"`
154+
AdjustedFundingRateFloor string `json:"adjustedFundingRateFloor"`
155+
FundingIntervalHours int `json:"fundingIntervalHours"`
156+
}
157+
128158
// GetLeverageBracketService get funding rate
129159
type GetLeverageBracketService struct {
130160
c *Client

0 commit comments

Comments
 (0)