common

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: MIT Imports: 14 Imported by: 134

Documentation

Index

Constants

View Source
const (
	KeyTypeHmac    = "HMAC"
	KeyTypeRsa     = "RSA"
	KeyTypeEd25519 = "ED25519"
)

Variables

This section is empty.

Functions

func AmountToLotSize

func AmountToLotSize(amount, minQty, stepSize string, precision int) string

AmountToLotSize convert amount to lot size

func Ed25519 added in v2.6.0

func Ed25519(secretKey string, data string) (*string, error)

func Hmac added in v2.6.0

func Hmac(secretKey string, data string) (*string, error)

func IsAPIError

func IsAPIError(e error) bool

IsAPIError check if e is an API error

func Rsa added in v2.6.0

func Rsa(secretKey string, data string) (*string, error)

func SignFunc added in v2.6.0

func SignFunc(keyType string) (func(string, string) (*string, error), error)

func ToInt added in v2.5.0

func ToInt(digit interface{}) (i int, err error)

func ToInt64 added in v2.5.0

func ToInt64(digit interface{}) (i int64, err error)

func ToJSONList

func ToJSONList(v []byte) []byte

ToJSONList convert v to json list if v is a map

Types

type APIError

type APIError struct {
	Code     int64  `json:"code"`
	Message  string `json:"msg"`
	Response []byte `json:"-"` // Assign the body value when the Code and Message fields are invalid.
}

APIError define API error when response status is 4xx or 5xx

func (APIError) Error

func (e APIError) Error() string

Error return error code and message

func (APIError) IsValid added in v2.6.0

func (e APIError) IsValid() bool

type PriceLevel added in v2.2.2

type PriceLevel struct {
	Price    string
	Quantity string
}

PriceLevel is a common structure for bids and asks in the order book.

func (*PriceLevel) Parse added in v2.2.2

func (p *PriceLevel) Parse() (float64, float64, error)

Parse parses this PriceLevel's Price and Quantity and returns them both. It also returns an error if either fails to parse.

Directories

Path Synopsis
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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