cmutils

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 DefaultContentType = map[string]string{
	"Content-Type": "application/x-www-form-urlencoded",
	"Accept":       "application/json",
}
View Source
var (
	PortfolioMarginBaseURL = "https://papi.binance.com"
)

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/pm/en/#endpoint-security-type
	SecurityType SecurityType

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

type PortfolioMarginClient

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

func NewPortfolioMarginClient

func NewPortfolioMarginClient(cfg *PortfolioMarginClientCfg) (*PortfolioMarginClient, error)

func (*PortfolioMarginClient) GenHeaders

func (p *PortfolioMarginClient) GenHeaders(t SecurityType) (map[string]string, error)

func (*PortfolioMarginClient) GetBaseURL

func (p *PortfolioMarginClient) GetBaseURL() string

func (*PortfolioMarginClient) GetDebug

func (p *PortfolioMarginClient) GetDebug() bool

func (*PortfolioMarginClient) GetKey

func (p *PortfolioMarginClient) GetKey() string

func (*PortfolioMarginClient) GetRecvWindow

func (p *PortfolioMarginClient) GetRecvWindow() int

func (*PortfolioMarginClient) GetSecret

func (p *PortfolioMarginClient) GetSecret() string

func (*PortfolioMarginClient) NeedSignature

func (p *PortfolioMarginClient) NeedSignature(t SecurityType) bool

func (*PortfolioMarginClient) SendHTTPRequest

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

type PortfolioMarginClientCfg

type PortfolioMarginClientCfg struct {
	Debug bool
	// Logger
	Logger *log.Logger

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

type SecurityType

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

Jump to

Keyboard shortcuts

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