diff --git a/bnc/config_por_mar.go b/bnc/config_por_mar.go index 9dd6e58..51b4b92 100644 --- a/bnc/config_por_mar.go +++ b/bnc/config_por_mar.go @@ -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 { @@ -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"` } diff --git a/bnc/user.go b/bnc/user.go index 5ad18f6..1d2aa6f 100644 --- a/bnc/user.go +++ b/bnc/user.go @@ -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...) //} diff --git a/bnc/user_test.go b/bnc/user_test.go index f9b8268..c343a87 100644 --- a/bnc/user_test.go +++ b/bnc/user_test.go @@ -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()) }