utils

package
v0.0.0-...-9ed198c Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 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"
	Cash     = "cash"
	Isolated = "isolated"
	Cross    = "cross"
	Buy      = "buy"
	Sell     = "sell"
	Market   = "market"
	Limit    = "limit"
	PostOnly = "post_only"
	FOK      = "fok"
	IOC      = "ioc"
	Index    = "index"
)

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
	HTTPClient *http.Client
	IsDemo     bool
}

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