utils

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Spot    = "SPOT"
	Margin  = "MARGIN"
	Swap    = "SWAP"
	Futures = "FUTURES"
	Option  = "OPTION"
)

Variables

View Source
var (
	RestURL      = "https://www.okx.com"
	PublicWsURL  = "wss://ws.okx.com:8443/ws/v5/public"
	PrivateWsURL = "wss://ws.okx.com:8443/ws/v5/private"

	AWSRestURL      = "https://aws.okx.com"
	AWSPublicWsURL  = "wss://wsaws.okx.com:8443/ws/v5/public"
	AWSPrivateWsURL = "wss://wsaws.okx.com:8443/ws/v5/private"
)

Functions

This section is empty.

Types

type InstrumentType

type InstrumentType = string

type OKXRestClient

type OKXRestClient struct {
	// contains filtered or unexported fields
}

func NewOKXRestClient

func NewOKXRestClient(cfg *OKXRestClientCfg) (*OKXRestClient, error)

func (*OKXRestClient) GenAuthHeaders

func (o *OKXRestClient) GenAuthHeaders(req utils.HTTPRequest) (map[string]string, error)

func (*OKXRestClient) GenPubHeaders

func (o *OKXRestClient) GenPubHeaders() (map[string]string, error)

func (*OKXRestClient) GetBaseURL

func (o *OKXRestClient) GetBaseURL() string

func (*OKXRestClient) GetDebug

func (o *OKXRestClient) GetDebug() bool

func (*OKXRestClient) GetKey

func (o *OKXRestClient) GetKey() string

func (*OKXRestClient) GetPassphrase

func (o *OKXRestClient) GetPassphrase() string

func (*OKXRestClient) GetSecret

func (o *OKXRestClient) GetSecret() string

func (*OKXRestClient) SendHTTPRequest

func (o *OKXRestClient) SendHTTPRequest(ctx context.Context, req utils.HTTPRequest) (*utils.ApiResponse, error)

type OKXRestClientCfg

type OKXRestClientCfg struct {
	BaseURL    string `validate:"required"`
	Key        string
	Secret     string
	Passphrase string
	Debug      bool
	// Logger
	Logger *slog.Logger
}

type Response

type Response struct {
	Code    string `json:"code"`
	Message string `json:"messsage"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL