Skip to content

Commit

Permalink
add var: bnc.PortfolioMarginAccountCMDetailConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
dwdwow committed Jun 18, 2024
1 parent d229811 commit 6404ef0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
18 changes: 17 additions & 1 deletion bnc/config_por_mar.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ type PortfolioMarginAccountPosition struct {
PositionSide FuturesPositionSide `json:"positionSide"`
SignPositionAmt float64 `json:"positionAmt,string"`
BreakEvenPrice float64 `json:"breakEvenPrice,string"`
UpdateTime int `json:"updateTime"`
UpdateTime int64 `json:"updateTime"`

// just for CM position
MaxQty string `json:"maxQty"`
}

func (p PortfolioMarginAccountPosition) AbsPositionAmt() float64 {
Expand All @@ -62,6 +65,19 @@ var PortfolioMarginAccountDetailConfig = cex.ReqConfig[cex.NilReqData, Portfolio
RespBodyUnmarshaler: fuBodyUnmshWrapper(cex.StdBodyUnmarshaler[PortfolioMarginAccountDetail]),
}

var PortfolioMarginAccountCMDetailConfig = cex.ReqConfig[cex.NilReqData, PortfolioMarginAccountDetail]{
ReqBaseConfig: cex.ReqBaseConfig{
BaseUrl: PapiBaseUrl,
Path: PapiV1 + "/cm/account",
Method: http.MethodGet,
IsUserData: true,
UserTimeInterval: 0,
IpTimeInterval: 0,
},
HTTPStatusCodeChecker: HTTPStatusCodeChecker,
RespBodyUnmarshaler: fuBodyUnmshWrapper(cex.StdBodyUnmarshaler[PortfolioMarginAccountDetail]),
}

type PortfolioMarginAccountBalanceParams struct {
Symbol string `s2m:"symbol,omitempty"`
}
Expand Down
4 changes: 4 additions & 0 deletions bnc/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func (u *User) PortfolioMarginAccountDetail(opts ...cex.CltOpt) (*resty.Response
return cex.Request(u, PortfolioMarginAccountDetailConfig, nil, opts...)
}

func (u *User) PortfolioMarginAccountCMDetail(opts ...cex.CltOpt) (*resty.Response, PortfolioMarginAccountDetail, cex.RequestError) {
return cex.Request(u, PortfolioMarginAccountCMDetailConfig, nil, opts...)
}

//func (u *User) PortfolioMarginBalance(asset string, opts ...cex.CltOpt) (*resty.Response, PortfolioMarginBalance, cex.RequestError) {
// return cex.Request(u, PortfolioMarginBalanceConfig, PortfolioMarginAccountBalanceParams{asset}, opts...)
//}
Expand Down
4 changes: 4 additions & 0 deletions bnc/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ func TestUser_PortfolioMarginAccountDetail(t *testing.T) {
userTestChecker(newTestVIPPortmarUser().PortfolioMarginAccountDetail())
}

func TestUser_PortfolioMarginAccountCMDetail(t *testing.T) {
userTestChecker(newTestVIPPortmarUser().PortfolioMarginAccountCMDetail())
}

func TestUser_PortfolioMarginAccountInformation(t *testing.T) {
userTestChecker(newTestVIPPortmarUser().PortfolioMarginAccountInformation())
}
Expand Down

0 comments on commit 6404ef0

Please sign in to comment.