common

package
v0.0.0-...-fcd27ab Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPriceLevel = errors.New("failed to parse price level")

Functions

func AmountToLotSize

func AmountToLotSize(lot float64, precision int, amount float64) float64

AmountToLotSize converts an amount to a lot sized amount

func IsAPIError

func IsAPIError(e error) bool

IsAPIError check if e is an API 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"`
}

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

type PriceLevel

type PriceLevel struct {
	Price    float64
	Quantity float64
}

func (*PriceLevel) MarshalJSON

func (p *PriceLevel) MarshalJSON() ([]byte, error)

func (*PriceLevel) UnmarshalJSON

func (p *PriceLevel) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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