Documentation
¶
Index ¶
- Constants
- func ConnectMongo(ctx context.Context, conf MongoConf) (*mongo.Database, error)
- func IsDuplicateError(err error) bool
- func MergeTick(o1, h1, l1, c1, v1, o2, h2, l2, c2, v2 float64) (open, high, low, close, volume float64)
- func NewZapLogger(level string, outputPaths, errorPaths []string) (*zap.Logger, error)
- func ParseJsonConfig(filename string, config interface{}) error
- type BroadcastConf
- type Candle
- type Exchange
- type ExchangeConf
- type Grid
- type GridStrategyConf
- type HistoryConf
- type LogConf
- type MongoConf
- type MySQLConf
- type Order
- type OrderStatus
- type OrderType
- type ResponseHandler
- type RestAPIExchange
- type RestGridStrategyConf
- type SQLiteConf
- type Ticker
- type Trade
- type WsAPIExchange
Constants ¶
View Source
const ( GateIO = "gate" MXC = "mxc" OKEx = "okex" Huobi = "huobi" )
View Source
const ( Open OrderStatus = 1 // open but not filled Closed = 2 // full filled Filled = 3 // part filled Cancelled = 4 )
Variables ¶
This section is empty.
Functions ¶
func ConnectMongo ¶ added in v0.6.0
func IsDuplicateError ¶ added in v0.6.0
func NewZapLogger ¶ added in v0.12.0
func ParseJsonConfig ¶
Types ¶
type BroadcastConf ¶ added in v0.7.7
type Candle ¶ added in v0.7.5
type Exchange ¶ added in v0.7.2
type Exchange interface {
RestAPIExchange
WsAPIExchange
}
common exchange interface, for all symbols, all crypto-exchanges
type ExchangeConf ¶ added in v0.5.1
type GridStrategyConf ¶ added in v0.5.8
type HistoryConf ¶ added in v0.6.1
type Order ¶ added in v0.7.14
type Order struct {
Id uint64
ClientOrderId string `bson:"clientOrderId"`
Type string
Symbol string
InitialPrice decimal.Decimal `bson:"initialPrice"`
InitialAmount decimal.Decimal
Timestamp int64
Status string
FilledPrice decimal.Decimal
FilledAmount decimal.Decimal
Trades []Trade
Fee map[string]decimal.Decimal
}
type OrderStatus ¶ added in v0.7.14
type OrderStatus = int
type ResponseHandler ¶ added in v0.10.15
type ResponseHandler func(response interface{})
type RestAPIExchange ¶ added in v0.10.0
type RestAPIExchange interface {
PricePrecision(symbol string) int32
AmountPrecision(symbol string) int32
MinAmount(symbol string) decimal.Decimal
MinTotal(symbol string) decimal.Decimal
SpotAvailableBalance() (map[string]decimal.Decimal, error)
LastPrice(symbol string) (decimal.Decimal, error)
CandleBySize(symbol string, period time.Duration, size int) (Candle, error)
CandleFrom(symbol, clientId string, period time.Duration, from, to time.Time) (Candle, error)
//PlaceOrder(orderType, symbol, clientOrderId string, price, amount decimal.Decimal) (int64, error)
BuyLimit(symbol, clientOrderId string, price, amount decimal.Decimal) (orderId int64, err error)
SellLimit(symbol, clientOrderId string, price, amount decimal.Decimal) (orderId int64, err error)
BuyMarket(symbol, clientOrderId string, amount decimal.Decimal) (orderId int64, err error)
SellMarket(symbol, clientOrderId string, amount decimal.Decimal) (orderId int64, err error)
BuyStopLimit(symbol, clientOrderId string, price, amount, stopPrice decimal.Decimal) (orderId int64, err error)
SellStopLimit(symbol, clientOrderId string, price, amount, stopPrice decimal.Decimal) (orderId int64, err error)
GetOrderById(orderId uint64, symbol string) (Order, error)
CancelOrder(symbol string, orderId uint64) error
}
common exchange interface for all symbols
type RestGridStrategyConf ¶ added in v0.5.8
type SQLiteConf ¶ added in v0.5.8
type SQLiteConf struct {
Location string
}
type WsAPIExchange ¶ added in v0.10.0
type WsAPIExchange interface {
SubscribeOrder(ctx context.Context, symbol, clientId string, responseHandler ResponseHandler)
SubscribeCandlestick(ctx context.Context, symbol, clientId string, period time.Duration, responseHandler ResponseHandler)
SubscribeCandlestickWithReq(ctx context.Context, symbol, clientId string, period time.Duration, responseHandler ResponseHandler)
}
Click to show internal directories.
Click to hide internal directories.