hs

package module
v0.7.12 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: MIT Imports: 9 Imported by: 32

README

hs

hs golang utils lib

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func ConnectMongo added in v0.6.0

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

func IsDuplicateError added in v0.6.0

func IsDuplicateError(err error) bool

func ParseJsonConfig

func ParseJsonConfig(filename string, config 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

type Exchange added in v0.7.2

type Exchange interface {
	RestAPI
	WsAPI
}

common exchange interface, for all symbols, all crypto-exchanges

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 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 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 RestAPI added in v0.7.4

type RestAPI interface {
	GetSpotBalance() (map[string]decimal.Decimal, error)
	GetCandle(symbol, clientId, period string, from, to time.Time) (Candle, error)

	PlaceOrder(orderType, symbol, clientOrderId string, price, amount decimal.Decimal) (uint64, error)
	CancelOrder(orderId uint64) error
}

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

type WsAPI added in v0.7.4

type WsAPI interface {
	SubscribeCandlestick(ctx context.Context, symbol, clientId string, responseHandler websocketclientbase.ResponseHandler)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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