liquidation

package
v0.1.41 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data added in v0.1.35

type Data struct {
	UpdatedTime int64  `json:"updatedTime"`
	Symbol      string `json:"symbol"`
	Size        string `json:"size"`
	Price       string `json:"price"`
	Side        string `json:"side"`
}

Data struct represents individual liquidation data points.

type Liquidation

type Liquidation interface {
	// SetClient sets the client for the liquidation functionality.
	SetClient(client *client.Client) error

	// Subscribe subscribes to liquidation data for the specified symbols.
	// It also stores the callback for each topic.
	Subscribe(symbols []string, callback func(response Data)) error

	// Unsubscribe unsubscribes from the specified topics.
	Unsubscribe(topics ...string) error

	// Listen reads the next message from the liquidation channel.
	Listen() (int, []byte, error)

	// Close closes the connection to the liquidation channel.
	Close()

	// GetMessagesChan returns a channel that receives messages from the liquidation channel.
	GetMessagesChan() <-chan []byte

	// Stop stops the liquidation functionality.
	Stop()
}

Liquidation represents the interface for the liquidation functionality.

func New

func New(cli *client.Client) Liquidation

New creates a new instance of LiquidationImpl.

type Response added in v0.1.35

type Response struct {
	Topic string `json:"topic"`
	Type  string `json:"type"`
	Data  Data   `json:"data"`
	Ts    int64  `json:"ts"`
}

Response struct represents the liquidation response from the server.

Jump to

Keyboard shortcuts

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