package bybit_connector import ( "context" "encoding/json" "github.com/wuhewuhe/bybit.go.api/handlers" "net/http" ) type AccountClient struct { c *Client params map[string]interface{} } func (s *AccountClient) GetTransactionLog(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodGet, endpoint: "/v5/account/transaction-log", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) GetFeeRates(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodGet, endpoint: "/v5/account/fee-rate", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) GetAccountWallet(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodGet, endpoint: "/v5/account/wallet-balance", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) GetBorrowHistory(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodGet, endpoint: "/v5/account/borrow-history", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) GetCoinGreeks(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodGet, endpoint: "/v5/asset/coin-greeks", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) GetCollateralInfo(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodGet, endpoint: "/v5/account/collateral-info", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) GetAccountInfo(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { r := &request{ method: http.MethodGet, endpoint: "/v5/account/upgrade-to-uta", secType: secTypeSigned, } data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) GetMMPState(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { r := &request{ method: http.MethodGet, endpoint: "/v5/account/mmp-state", secType: secTypeSigned, } data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) SetSpotHedgeMode(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { r := &request{ method: http.MethodGet, endpoint: "/v5/account/set-hedging-mode", secType: secTypeSigned, } data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) UpgradeToUTA(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { r := &request{ method: http.MethodPost, endpoint: "/v5/account/upgrade-to-uta", secType: secTypeSigned, } data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) SetCollateralCoin(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { r := &request{ method: http.MethodPost, endpoint: "/v5/account/set-collateral-switch", secType: secTypeSigned, } data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) SetMarginMode(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { r := &request{ method: http.MethodPost, endpoint: "/v5/account/set-margin-mode", secType: secTypeSigned, } data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) SetMarketMakerProtection(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { r := &request{ method: http.MethodPost, endpoint: "/v5/account/mmp-modify", secType: secTypeSigned, } data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *AccountClient) ResetMarketMakerProtection(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { r := &request{ method: http.MethodPost, endpoint: "/v5/account/mmp-reset", secType: secTypeSigned, } data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil }