spotutils

package
v0.0.0-...-795c9cd Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BaseURL = "https://api.binance.com"
)
View Source
var DefaultContentType = map[string]string{
	"Content-Type": "application/x-www-form-urlencoded",
	"Accept":       "application/json",
}

Functions

This section is empty.

Types

type HTTPRequest

type HTTPRequest struct {
	// SecurityType each endpoint has a security type that determines how you will interact with it
	// docs: https://binance-docs.github.io/apidocs/spot/en/#endpoint-security-type
	SecurityType SecurityType

	BaseURL string
	Path    string
	Method  string
	Headers map[string]string
	Query   any
	Body    any
}

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 HTTPRequest) ([]byte, error)

type SpotClientCfg

type SpotClientCfg struct {
	Debug bool
	// Logger
	Logger *log.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