bybit.go.api/market.go

37 lines
724 B
Go
Raw Normal View History

2023-11-03 16:29:17 +02:00
package bybit_connector
2023-10-30 20:26:54 +02:00
import (
"context"
2023-11-03 16:29:17 +02:00
"encoding/json"
2023-10-30 20:26:54 +02:00
"net/http"
)
2023-11-03 16:29:17 +02:00
type ServerTimeResult struct {
TimeSecond string `json:"timeSecond"`
TimeNano string `json:"timeNano"`
}
// ServerTime Binance Check Server Time endpoint (GET /v5/market/time)
2023-10-30 20:26:54 +02:00
type ServerTime struct {
c *Client
}
2023-11-03 16:29:17 +02:00
// Do Send the request
func (s *ServerTime) Do(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) {
2023-10-30 20:26:54 +02:00
r := &request{
method: http.MethodGet,
endpoint: "/v5/market/time",
secType: secTypeNone,
}
2023-11-03 16:29:17 +02:00
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
2023-10-30 20:26:54 +02:00
}