utils

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogPrefix = "tomochain"
)

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 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 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

NewFileLogger 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 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