ticker

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 5 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.5

type Data struct {
	Symbol            string `json:"symbol"`
	TickDirection     string `json:"tickDirection"`
	Price24HPcnt      string `json:"price24hPcnt"`
	LastPrice         string `json:"lastPrice"`
	PrevPrice24H      string `json:"prevPrice24h"`
	HighPrice24H      string `json:"highPrice24h"`
	LowPrice24H       string `json:"lowPrice24h"`
	PrevPrice1H       string `json:"prevPrice1h"`
	MarkPrice         string `json:"markPrice"`
	IndexPrice        string `json:"indexPrice"`
	OpenInterest      string `json:"openInterest"`
	OpenInterestValue string `json:"openInterestValue"`
	Turnover24H       string `json:"turnover24h"`
	Volume24H         string `json:"volume24h"`
	NextFundingTime   string `json:"nextFundingTime"`
	FundingRate       string `json:"fundingRate"`
	Bid1Price         string `json:"bid1Price"`
	Bid1Size          string `json:"bid1Size"`
	Ask1Price         string `json:"ask1Price"`
	Ask1Size          string `json:"ask1Size"`
}

type Ticker

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

Ticker manages ticker subscriptions and updates.

func New

func New(client *client.Client) Ticker

New initializes a new Ticker instance with context for graceful shutdown.

func (*Ticker) Listen added in v0.0.7

func (t *Ticker) Listen()

Listen method modified to support graceful shutdown.

func (*Ticker) Shutdown added in v0.0.7

func (t *Ticker) Shutdown()

Shutdown method to cleanly terminate the Listen loop.

func (*Ticker) Subscribe added in v0.0.7

func (t *Ticker) Subscribe(symbol string, callback func(Data)) error

Subscribe to the ticker updates for a given symbol. Subscribe to the ticker updates for a given symbol.

func (*Ticker) Unsubscribe added in v0.0.7

func (t *Ticker) Unsubscribe(symbol string) error

Unsubscribe from the ticker updates for a given symbol.

Jump to

Keyboard shortcuts

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