ftx_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 Request

type Request struct {
	Op      string `json:"op"`
	Channel string `json:"channel,omitempty"`
	Market  string `json:"market,omitempty"`
}

type Response

type Response struct {
	Type    string `json:"type"`
	Channel string `json:"channel,omitempty"`
	Market  string `json:"market,omitempty"`

	Code int64 `json:"code,omitempty"`
	Data struct {
		Ask     decimal.Decimal `json:"ask,omitempty"`
		AskSize decimal.Decimal `json:"askSize,omitempty"`
		Bid     decimal.Decimal `json:"bid,omitempty"`
		BidSize decimal.Decimal `json:"bidSize,omitempty"`
		Last    decimal.Decimal `json:"last,omitempty"`
		Time    float64         `json:"time,omitempty"`
	} `json:"data,omitempty"`
	Msg         string `json:"msg,omitempty"`
	ReceiveTime int64  `json:"rt,omitempty"`
}

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(response *Response)) *WsClient

func (*WsClient) ConnectAndSubscribe

func (w *WsClient) ConnectAndSubscribe() error

func (*WsClient) Ping

func (w *WsClient) Ping()

func (*WsClient) ReadLoop

func (w *WsClient) ReadLoop()

func (*WsClient) Serve

func (w *WsClient) Serve() error

func (*WsClient) Subscribe

func (w *WsClient) Subscribe() error

Jump to

Keyboard shortcuts

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