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: 11 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type KlineInterval

type KlineInterval string
var (
	Second1  KlineInterval = "1s"
	Minute1  KlineInterval = "1m"
	Minute3  KlineInterval = "3m"
	Minute5  KlineInterval = "5m"
	Minute15 KlineInterval = "15m"
	Minute30 KlineInterval = "30m"
	Hour1    KlineInterval = "1h"
	Hour2    KlineInterval = "2h"
	Hour4    KlineInterval = "4h"
	Hour6    KlineInterval = "6h"
	Hour8    KlineInterval = "8h"
	Hour12   KlineInterval = "12h"
	Day1     KlineInterval = "1d"
	Day3     KlineInterval = "3d"
	Week1    KlineInterval = "1w"
	Month1   KlineInterval = "1M"
)

type SecurityType

type SecurityType string
var (
	NONE        SecurityType = "NONE"
	TRADE       SecurityType = "TRADE"
	MARGIN      SecurityType = "MARGIN"
	USER_DATA   SecurityType = "USER_DATA"
	USER_STREAM SecurityType = "USER_STREAM"
	MARKET_DATA SecurityType = "MARKET_DATA"
)

type SpotClient

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

func NewSpotClient

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

func (*SpotClient) GenHeaders

func (s *SpotClient) GenHeaders(t SecurityType) (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) NeedSignature

func (s *SpotClient) NeedSignature(t SecurityType) bool

func (*SpotClient) SendHTTPRequest

func (s *SpotClient) SendHTTPRequest(ctx context.Context, req utils.HTTPRequest) (*utils.ApiResponse, error)

type SpotClientCfg

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

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

Jump to

Keyboard shortcuts

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