kline

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: May 24, 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

type Data struct {
	Start     int64  `json:"start"`
	End       int64  `json:"end"`
	Interval  string `json:"interval"`
	Open      string `json:"open"`
	Close     string `json:"close"`
	High      string `json:"high"`
	Low       string `json:"low"`
	Volume    string `json:"volume"`
	Turnover  string `json:"turnover"`
	Confirm   bool   `json:"confirm"`
	Timestamp int64  `json:"timestamp"`
}

Data struct represents individual kline data points.

type Kline

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

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

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

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

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

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

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

Kline represents the interface for the kline functionality.

func New

func New(c *client.Client) (Kline, error)

New creates a new instance of KlineImpl.

type Response added in v0.1.8

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

Response struct represents the kline response from the server.

Jump to

Keyboard shortcuts

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