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

This section is empty.

Variables

View Source
var (
	BaseURL = "https://contract.mexc.com"
)

Functions

This section is empty.

Types

type ContractClient

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

func NewContractClient

func NewContractClient(cfg *ContractClientCfg) (*ContractClient, error)

func (*ContractClient) GenAuthHeaders

func (c *ContractClient) GenAuthHeaders(req HTTPRequest) (map[string]string, error)

func (*ContractClient) GenPubHeaders

func (c *ContractClient) GenPubHeaders() (map[string]string, error)

func (*ContractClient) GetBaseURL

func (c *ContractClient) GetBaseURL() string

func (*ContractClient) GetDebug

func (c *ContractClient) GetDebug() bool

func (*ContractClient) GetKey

func (c *ContractClient) GetKey() string

func (*ContractClient) GetRecvWindow

func (c *ContractClient) GetRecvWindow() int

func (*ContractClient) GetSecret

func (c *ContractClient) GetSecret() string

func (*ContractClient) SendHTTPRequest

func (c *ContractClient) SendHTTPRequest(ctx context.Context, req HTTPRequest) ([]byte, error)

type ContractClientCfg

type ContractClientCfg struct {
	Debug bool
	// Logger
	Logger *slog.Logger

	BaseURL    string `validate:"required"`
	Key        string
	Secret     string
	RecvWindow int
}

type HTTPRequest

type HTTPRequest struct {
	BaseURL string
	Path    string
	Method  string
	Headers map[string]string
	Query   any
	Body    any
}

type KlineInterval

type KlineInterval string
var (
	Minute1  KlineInterval = "Min1"
	Minute5  KlineInterval = "Min5"
	Minute15 KlineInterval = "Min15"
	Minute30 KlineInterval = "Min30"
	Minute60 KlineInterval = "Min60"
	Hour4    KlineInterval = "Hour4"
	Hour8    KlineInterval = "Hour8"
	Day1     KlineInterval = "Day1"
	Week1    KlineInterval = "Week1"
	Month1   KlineInterval = "Month1"
)

Jump to

Keyboard shortcuts

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