utils

package
v1.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogPrefix = ""
)

TODO: add log prefix to params

Variables

View Source
var Logger = NewLogger("main", "./logs/main.log")
View Source
var StdoutLogger = NewStandardOutputLogger()
View Source
var TerminalLogger = NewColoredLogger()

Functions

func Ethers

func Ethers(value int64) *big.Int

func GetAddressFromPublicKey

func GetAddressFromPublicKey(pk []byte) common.Address

GetAddressFromPublicKey get derived address from public key

func GetMarketsChannelID

func GetMarketsChannelID(channel string) string

func GetModTime added in v1.2.0

func GetModTime(ts, interval int64, unit string) (int64, int64)

GetModTime get round time by step

func GetOHLCVChannelID

func GetOHLCVChannelID(bt, qt common.Address, unit string, duration int64) string

func GetOrderBookChannelID

func GetOrderBookChannelID(bt, qt common.Address) string

func GetPairKey

func GetPairKey(bt, qt common.Address) string

GetPairKey return the pair key identifier corresponding to two

func GetPriceBoardChannelID

func GetPriceBoardChannelID(bt, qt common.Address) string

func GetTickChannelID

func GetTickChannelID(bt, qt common.Address, unit string, duration int64) string

GetTickChannelID is used to get the channel id for OHLCV data streaming it takes pairname, duration and units of data streaming

func GetTradeChannelID

func GetTradeChannelID(bt, qt common.Address) string

func IsNativeTokenByAddress

func IsNativeTokenByAddress(address common.Address) bool

func JSON

func JSON(x interface{}) string

func NewColoredLogger

func NewColoredLogger() *logging.Logger

func NewErrorLogger

func NewErrorLogger() *logging.Logger

func NewFileLogger

func NewFileLogger(module string, logFile string) *logging.Logger

NewFileLogger creates a logging utility that outputs to the file passed as argument but but does not output to stdout.

func NewLogger

func NewLogger(module string, logFile string) *logging.Logger

NewLogger creates a logging utility that outputs to the file passed as argument and also output to stdout.

func NewNoopLogger

func NewNoopLogger() *logging.Logger

func NewStandardOutputLogger

func NewStandardOutputLogger() *logging.Logger

NewFileLogger creates a logging utility that only output to stdout.

func PrintError

func PrintError(msg string, err error)

func PrintJSON

func PrintJSON(x interface{})

func Retry

func Retry(retries int, fn func() error) error

func ToDecimal

func ToDecimal(value *big.Int) float64

func UintToPaddedString

func UintToPaddedString(num int64) string

UintToPaddedString converts an int to string of length 19 by padding with 0

func Union

func Union(a, b []common.Address) []common.Address

Union get set of two array

func UnitToSecond added in v1.2.0

func UnitToSecond(interval int64, unit string) int64

UnitToSecond time uint to second

func Use

func Use(...interface{})

Util function to handle unused variables while testing

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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