msgmanager

package
v0.0.0-...-df03107 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TickConst = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DepthManager

type DepthManager struct {
	BuyDepth  DepthRecordList
	SellDepth DepthRecordList
	// contains filtered or unexported fields
}

func NewDepthManager

func NewDepthManager(exchange, symbol string) *DepthManager

func (*DepthManager) Handle

func (manager *DepthManager) Handle(
	action int, depList []*model.DepthRecord, ch chan api.MsgData)

type DepthRecordList

type DepthRecordList []*model.DepthRecord

func (DepthRecordList) Len

func (s DepthRecordList) Len() int

func (DepthRecordList) Less

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

func (DepthRecordList) Swap

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

type FundingManager

type FundingManager struct {
	Funding *model.Funding
	Service *model.FundingService
	// contains filtered or unexported fields
}

func NewFundingManager

func NewFundingManager(
	exchange, symbol string, db *storage.MongoProxy) *FundingManager

func (*FundingManager) Handle

func (manager *FundingManager) Handle(
	action int, fund []*model.Funding, ch chan api.MsgData)

type Kline

type Kline struct {
	KlineService *model.KlineService
	Data         []*model.Kline
	// contains filtered or unexported fields
}

func NewKline

func NewKline(
	ctx context.Context, exchange, symbol string,
	interval time.Duration, db *storage.MongoProxy) *Kline

func (*Kline) Download

func (kline *Kline) Download(start time.Time) bool

func (*Kline) LoadKlines

func (kline *Kline) LoadKlines()

func (*Kline) Merge

func (kline *Kline) Merge(start time.Time) bool

func (*Kline) Start

func (kline *Kline) Start(ch chan api.MsgData)

func (*Kline) Stop

func (kline *Kline) Stop()

func (*Kline) UpdateKline

func (kline *Kline) UpdateKline(data *model.Trade, ch chan api.MsgData)

type KlineManager

type KlineManager struct {
	Klines map[string]*Kline

	TradeCh chan model.Trade
	// contains filtered or unexported fields
}

func NewKlineManager

func NewKlineManager(
	ctx context.Context, tz *time.Location, exchange string,
	symbols []string, interval time.Duration,
	db *storage.MongoProxy) *KlineManager

func (*KlineManager) Start

func (manager *KlineManager) Start(ch chan api.MsgData)

func (*KlineManager) Stop

func (manager *KlineManager) Stop()

type KlineMsg

type KlineMsg struct {
	K        model.Kline
	Interval time.Duration
}

type LiquidationManager

type LiquidationManager struct {
	Liqs               []*model.Liquidation
	LiquidationService *model.LiquidationService
	// contains filtered or unexported fields
}

func NewLiquidationManager

func NewLiquidationManager(
	exchange, symbol string, db *storage.MongoProxy) *LiquidationManager

func (*LiquidationManager) Handle

func (manager *LiquidationManager) Handle(
	action int, liq []*model.Liquidation, ch chan api.MsgData)

type MessageManager

type MessageManager struct {
	Tz *time.Location

	TradeManagers    map[string]*TradeManager
	QuoteManagers    map[string]*QuoteManager
	PositionManagers map[string]*PositionManager
	OrderManagers    map[string]*OrderManager
	DepthManagers    map[string]*DepthManager
	FundingManagers  map[string]*FundingManager

	KlineManager map[int]*KlineManager
	MsgCh        chan api.MsgData
	SendCh       chan api.MsgData
	DB           *storage.MongoProxy
	// contains filtered or unexported fields
}

func NewMsgManager

func NewMsgManager(
	ctx context.Context, interval []int, exchange string,
	symbols []string, tz string, mongoCfg *baseconfig.MongoConfig) *MessageManager

func (*MessageManager) SetExchangeAPI

func (manager *MessageManager) SetExchangeAPI(ex api.ExchangeAPI)

func (*MessageManager) Start

func (manager *MessageManager) Start()

func (*MessageManager) Stop

func (manager *MessageManager) Stop()

type OrderManager

type OrderManager struct {
	Orders []*model.Order
	// contains filtered or unexported fields
}

func NewOrderManager

func NewOrderManager(
	tz *time.Location, exchange, symbol string) *OrderManager

func (*OrderManager) Handle

func (manager *OrderManager) Handle(
	action int, orderList interface{}, ch chan api.MsgData)

type PositionManager

type PositionManager struct {
	Positions []*model.Position
	// contains filtered or unexported fields
}

func NewPositionManager

func NewPositionManager(exchange, symbol string) *PositionManager

func (*PositionManager) Handle

func (manager *PositionManager) Handle(
	action int, posList interface{}, ch chan api.MsgData)

type QuoteManager

type QuoteManager struct {
	Quotes []*model.Quote
	// contains filtered or unexported fields
}

func NewQuoteManager

func NewQuoteManager(exchange, symbol string) *QuoteManager

func (*QuoteManager) Handle

func (manager *QuoteManager) Handle(
	action int, quotes []*model.Quote, ch chan api.MsgData)

type TradeManager

type TradeManager struct {
	Trades []*model.Trade
	// contains filtered or unexported fields
}

func NewTradeManger

func NewTradeManger(
	exchange, symbol string, km map[int]*KlineManager,
	db *storage.MongoProxy) *TradeManager

func (*TradeManager) Handle

func (manager *TradeManager) Handle(
	action int, trade []*model.Trade, ch chan api.MsgData)

Jump to

Keyboard shortcuts

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