hs

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 12 Imported by: 32

README

hs

hs golang utils lib

Documentation

Index

Constants

View Source
const (
	GateIO  = "gate"
	MXC     = "mxc"
	OKEx    = "okex"
	Huobi   = "huobi"
	Binance = "binance"
)

Variables

This section is empty.

Functions

func ConnectMongo added in v0.6.0

func ConnectMongo(ctx context.Context, conf MongoConf) (*mongo.Database, error)

func DeleteInt64 added in v0.18.0

func DeleteInt64(ctx context.Context, coll *mongo.Collection, key string) error

func DeleteKey added in v0.18.0

func DeleteKey(ctx context.Context, coll *mongo.Collection, key string) error

func IsDuplicateError added in v0.6.0

func IsDuplicateError(err error) bool

func LoadInt64 added in v0.18.0

func LoadInt64(ctx context.Context, coll *mongo.Collection, key string) (int64, error)

func LoadKey added in v0.18.0

func LoadKey(ctx context.Context, coll *mongo.Collection, key string, value interface{}) error

func MergeTick added in v0.10.10

func MergeTick(o1, h1, l1, c1, v1, o2, h2, l2, c2, v2 float64) (open, high, low, close, volume float64)

func NewZapLogger added in v0.12.0

func NewZapLogger(conf LogConf) (*zap.Logger, error)

func ParseJsonConfig

func ParseJsonConfig(filename string, config interface{}) error

func SaveInt64 added in v0.18.0

func SaveInt64(ctx context.Context, coll *mongo.Collection, key string, value int64) error

func SaveKey added in v0.18.0

func SaveKey(ctx context.Context, coll *mongo.Collection, key string, value interface{}) error

Types

type BroadcastConf added in v0.7.7

type BroadcastConf = broadcast.Config

type Candle added in v0.7.5

type Candle struct {
	Capacity  int
	Timestamp []int64 // unix timestamp in seconds
	Open      []float64
	High      []float64
	Low       []float64
	Close     []float64
	Volume    []float64
}

func NewCandle added in v0.7.5

func NewCandle(capacity int) Candle

func (*Candle) Add added in v0.7.5

func (c *Candle) Add(other Candle)

func (*Candle) Append added in v0.7.5

func (c *Candle) Append(ticker Ticker)

func (Candle) Length added in v0.7.5

func (c Candle) Length() int

func (*Candle) Truncate added in v0.7.13

func (c *Candle) Truncate()

type ExchangeConf added in v0.5.1

type ExchangeConf struct {
	Name    string // see const below
	Label   string
	Symbols []string
	Key     string
	Secret  string
	Host    string
}

type FloatTuple added in v0.26.1

type FloatTuple struct {
	Key   interface{}
	Value float64
}

type GinConf added in v0.29.2

type GinConf struct {
	Listen string // "host:port"
	Log    string
}

type Grid added in v0.5.8

type Grid struct {
	Id         int
	Price      decimal.Decimal
	AmountBuy  decimal.Decimal
	AmountSell decimal.Decimal
	TotalBuy   decimal.Decimal
	Order      uint64
}

type GridStrategyConf added in v0.5.8

type GridStrategyConf struct {
	MaxPrice float64
	MinPrice float64
	Number   int
	Total    float64
}

type HistoryConf added in v0.6.1

type HistoryConf struct {
	Prefix   string
	Interval string
}

type KVSlice added in v0.26.0

type KVSlice []FloatTuple

func (KVSlice) Len added in v0.26.0

func (s KVSlice) Len() int

func (KVSlice) Less added in v0.26.0

func (s KVSlice) Less(i, j int) bool

func (KVSlice) Swap added in v0.26.0

func (s KVSlice) Swap(i, j int)

type LogConf added in v0.12.1

type LogConf struct {
	Level   string
	Outputs []string
	Errors  []string
}

type MongoConf added in v0.5.0

type MongoConf struct {
	// mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
	URI         string `json:"uri"`
	Database    string `json:"database"`
	MaxPoolSize uint64 `json:"maxPoolSize"`
	MinPoolSize uint64 `json:"minPoolSize"`
	AppName     string `json:"appName"`
}

type MySQLConf added in v0.5.0

type MySQLConf struct {
	URI string `json:"uri"`
}

type QueueConf added in v0.31.0

type QueueConf struct {
	URI  string `json:"uri"`
	Name string `json:"name"`
}

type RestGridStrategyConf added in v0.5.8

type RestGridStrategyConf struct {
	MaxPrice  float64
	MinPrice  float64
	Number    int
	Total     float64
	Rebalance bool
	Interval  string // sleep interval
}

type SQLiteConf added in v0.5.8

type SQLiteConf struct {
	Location string
}

type TelegramBotConf added in v0.30.1

type TelegramBotConf struct {
	Name  string // bot username
	Token string
	Debug bool
}

type Ticker added in v0.7.5

type Ticker struct {
	Timestamp int64 // unix timestamp in seconds
	Open      float64
	High      float64
	Low       float64
	Close     float64
	Volume    float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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