core

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: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RetryMaxErrCode         = 2001
	ExchangeNotExistErrCode = 2002
)
View Source
const (
	VERSION = "v0.1.0"
)

Variables

View Source
var (
	RetryMaxErr = errcode.CreateCoinBaseError(
		RetryMaxErrCode,
		"Reach the maximum number of retries",
	)
	ExchangeNotExistErr = errcode.CreateCoinBaseError(
		ExchangeNotExistErrCode, "Callback not exist: %s")
)

Functions

func PrintInfo

func PrintInfo()
func PrintLogo()

func PrintRawInfo

func PrintRawInfo()

Types

type CoinCorpApp

type CoinCorpApp struct {
	Ctx context.Context

	Cfg *config.CoinCorpConfig

	Exchange map[string]api.ExchangeAPI
	// contains filtered or unexported fields
}

func GetApp

func GetApp() *CoinCorpApp

func NewCoinCorpApp

func NewCoinCorpApp(
	ctx context.Context, cfg *config.CoinCorpConfig,
	msgManagerMap map[string]*msgmanager.MessageManager) *CoinCorpApp

func (*CoinCorpApp) Start

func (app *CoinCorpApp) Start() error

func (*CoinCorpApp) Stop

func (app *CoinCorpApp) Stop()

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(ctx context.Context, exchange string,
	msgHandler api.ExchangeAPI) *Worker

func (*Worker) StartWorker

func (w *Worker) StartWorker(app *CoinCorpApp)

func (*Worker) StopWorker

func (w *Worker) StopWorker()

type WsClient

type WsClient struct {
	WsConfig *config.WebsocketConfig

	ReadWait          time.Duration
	WriteWait         time.Duration
	HeartbeatDuration time.Duration

	Conn *websocket.Conn
	// contains filtered or unexported fields
}

func NewWsClient

func NewWsClient(
	ctx context.Context, exchangeName string,
	wsAddress string, exchange api.ExchangeAPI,
	wsConfig *config.WebsocketConfig,
	worker *Worker) (*WsClient, error)

func (*WsClient) Auth

func (ws *WsClient) Auth() error

func (*WsClient) ReadMsg

func (ws *WsClient) ReadMsg() error

func (*WsClient) StartClient

func (ws *WsClient) StartClient(app *CoinCorpApp)

func (*WsClient) StopClient

func (ws *WsClient) StopClient()

func (*WsClient) Subscribe

func (ws *WsClient) Subscribe() error

func (*WsClient) WriteBinaryMsg

func (ws *WsClient) WriteBinaryMsg(msg []byte) error

func (*WsClient) WriteTextMsg

func (ws *WsClient) WriteTextMsg(msg []byte) error

Jump to

Keyboard shortcuts

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