2023-11-06 02:08:54 +02:00
|
|
|
package bybit_connector
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net/http"
|
2024-06-03 23:07:14 +03:00
|
|
|
|
|
|
|
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
|
2023-11-06 02:08:54 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type BrokerServiceClient struct {
|
|
|
|
c *Client
|
|
|
|
params map[string]interface{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *BrokerServiceClient) GetBrokerEarning(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,
|
2023-12-13 01:16:15 +02:00
|
|
|
endpoint: "/v5/broker/earnings-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 *BrokerServiceClient) GetBrokerAccountInfo(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/broker/account-info",
|
2023-11-06 02:08:54 +02:00
|
|
|
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
|
|
|
|
}
|