utils

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogPrefix = ""
)

Variables

View Source
var Logger = logging.MustGetLogger("main")
View Source
var StdoutLogger = logging.MustGetLogger("main")

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 GetLendingChannelID added in v1.2.0

func GetLendingChannelID(term uint64, lendingToken common.Address) string

GetLendingChannelID get channel from term and lending token

func GetLendingMarketsChannelID added in v1.2.0

func GetLendingMarketsChannelID(channel string) string

GetLendingMarketsChannelID format market chanel id

func GetLendingOhlcvChannelID added in v1.2.0

func GetLendingOhlcvChannelID(term uint64, lendingToken common.Address, unit string, duration int64) string

func GetLendingOrderBookChannelID added in v1.2.0

func GetLendingOrderBookChannelID(term uint64, lendingToken common.Address) string

func GetLendingPairName added in v1.2.0

func GetLendingPairName(term uint64, lendingTokenName string) string

func GetLendingTradeChannelID added in v1.2.0

func GetLendingTradeChannelID(term uint64, lendingToken common.Address) string

GetLendingTradeChannelID get channel from term and lending token

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 InitLogger added in v1.2.0

func InitLogger(logLevel string)

func IsNativeTokenByAddress

func IsNativeTokenByAddress(address common.Address) bool

func JSON

func JSON(x interface{}) string

func ParseLendingChannelID added in v1.2.0

func ParseLendingChannelID(id string) (uint64, common.Address, error)

ParseLendingTradeChannelID parse channel to get term and lending token

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 ToBigInt added in v1.2.0

func ToBigInt(s string) *big.Int

ToBigInt string to bigint

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