spotutils

package
v0.0.0-...-1d71415 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

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 = "1m"
	Minute5  KlineInterval = "5m"
	Minute15 KlineInterval = "15m"
	Minute30 KlineInterval = "30m"
	Minute60 KlineInterval = "60m"
	Hour4    KlineInterval = "4h"
	Day1     KlineInterval = "1d"
	Month1   KlineInterval = "1M"
)

type SpotClient

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

func NewSpotClient

func NewSpotClient(cfg *SpotClientCfg) (*SpotClient, error)

func (*SpotClient) GenAuthHeaders

func (s *SpotClient) GenAuthHeaders(req HTTPRequest) (map[string]string, error)

func (*SpotClient) GenPubHeaders

func (s *SpotClient) GenPubHeaders() (map[string]string, error)

func (*SpotClient) GetBaseURL

func (s *SpotClient) GetBaseURL() string

func (*SpotClient) GetDebug

func (s *SpotClient) GetDebug() bool

func (*SpotClient) GetKey

func (s *SpotClient) GetKey() string

func (*SpotClient) GetRecvWindow

func (s *SpotClient) GetRecvWindow() int

func (*SpotClient) GetSecret

func (s *SpotClient) GetSecret() string

func (*SpotClient) SendHTTPRequest

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

type SpotClientCfg

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

	BaseURL    string `validate:"required"`
	Key        string
	Secret     string
	RecvWindow int
	HTTPClient *http.Client
}

Jump to

Keyboard shortcuts

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