binance_ws

package
v0.0.0-...-093acf2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Stream string            `json:"stream"`
	Data   WsBookTickerEvent `json:"data"`
}

type WsBookTickerEvent

type WsBookTickerEvent struct {
	UpdateID     int64           `json:"u"`
	Symbol       string          `json:"s"`
	BestBidPrice decimal.Decimal `json:"b"`
	BestBidQty   decimal.Decimal `json:"B"`
	BestAskPrice decimal.Decimal `json:"a"`
	BestAskQty   decimal.Decimal `json:"A"`
	ReceiveTime  int64           `json:"rt"`
}

type WsClient

type WsClient struct {
	Conn *websocket.Conn
	// contains filtered or unexported fields
}

func NewWsClient

func NewWsClient(cfg *config.Config, log *zap.Logger, ctx context.Context, handler func(event *WsBookTickerEvent)) *WsClient

func (*WsClient) ConnectAndSubscribe

func (w *WsClient) ConnectAndSubscribe() error

func (*WsClient) ReadLoop

func (w *WsClient) ReadLoop()

func (*WsClient) Serve

func (w *WsClient) Serve() error

Jump to

Keyboard shortcuts

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