websocketmarket

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUBSCRIBE   = "SUBSCRIBE"
	UNSUBSCRIBE = "UNSUBSCRIBE"
)
View Source
const (
	MaxTryTimes = 5
)

Variables

View Source
var (
	USDMarginedMarketStreamBaseURL = "wss://fstream.binance.com"
	CombinedStreamRouter           = "/stream"
)

Functions

This section is empty.

Types

type AllMarkPriceTopicParam

type AllMarkPriceTopicParam struct {
	UpdateSpeed string `validate:"required,oneof=1s 3s"`
}

type BookDepthTopicParam

type BookDepthTopicParam struct {
	Symbol      string `validate:"required"`
	Level       int    `validate:"required,oneof=5 10 20"`
	UpdateSpeed string `validate:"required,oneof=100ms 250ms 500ms"`
}

type BookDiffDepthTopicParam

type BookDiffDepthTopicParam struct {
	Symbol      string `validate:"required"`
	UpdateSpeed string `validate:"required,oneof=100ms 250ms 500ms"`
}

type KlineTopicParam

type KlineTopicParam struct {
	Symbol   string                `validate:"required"`
	Interval umutils.KlineInterval `validate:"required,oneof=1m 3m 5m 15m 30m 1h 2h 4h 6h 8h 12h 1d 3d 1w 1M"`
}

type Listener

type Listener func(any)

type MarkPriceTopicParam

type MarkPriceTopicParam struct {
	Symbol      string `validate:"required"`
	UpdateSpeed string `validate:"required,oneof=1s 3s"`
}

type USDMarginedMarketStreamCfg

type USDMarginedMarketStreamCfg struct {
	Debug         bool
	BaseURL       string `validate:"required"`
	AutoReconnect bool   `validate:"required"`

	Logger *slog.Logger
}

type USDMarginedMarketStreamClient

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

func (*USDMarginedMarketStreamClient) AddListener

func (u *USDMarginedMarketStreamClient) AddListener(event string, listener Listener) *emission.Emitter

func (*USDMarginedMarketStreamClient) Close

func (*USDMarginedMarketStreamClient) GetAggTradeTopic

func (u *USDMarginedMarketStreamClient) GetAggTradeTopic(symbol string) (string, error)

func (*USDMarginedMarketStreamClient) GetAllBookTickersTopic

func (u *USDMarginedMarketStreamClient) GetAllBookTickersTopic() (string, error)

func (*USDMarginedMarketStreamClient) GetAllLiquidationOrdersTopic

func (u *USDMarginedMarketStreamClient) GetAllLiquidationOrdersTopic() (string, error)

func (*USDMarginedMarketStreamClient) GetAllMarketMiniTickersTopic

func (u *USDMarginedMarketStreamClient) GetAllMarketMiniTickersTopic() (string, error)

func (*USDMarginedMarketStreamClient) GetAllMarketPriceTopic

func (u *USDMarginedMarketStreamClient) GetAllMarketPriceTopic(param *AllMarkPriceTopicParam) (string, error)

func (*USDMarginedMarketStreamClient) GetAllMarketTickersTopic

func (u *USDMarginedMarketStreamClient) GetAllMarketTickersTopic() (string, error)

func (*USDMarginedMarketStreamClient) GetBookDepthTopic

func (u *USDMarginedMarketStreamClient) GetBookDepthTopic(params *BookDepthTopicParam) (string, error)

func (*USDMarginedMarketStreamClient) GetBookDiffDepthTopic

func (u *USDMarginedMarketStreamClient) GetBookDiffDepthTopic(params *BookDiffDepthTopicParam) (string, error)

func (*USDMarginedMarketStreamClient) GetBookTickerTopic

func (u *USDMarginedMarketStreamClient) GetBookTickerTopic(symbol string) (string, error)

func (*USDMarginedMarketStreamClient) GetKlineTopic

func (u *USDMarginedMarketStreamClient) GetKlineTopic(params *KlineTopicParam) (string, error)

func (*USDMarginedMarketStreamClient) GetLiquidationOrderTopic

func (u *USDMarginedMarketStreamClient) GetLiquidationOrderTopic(symbol string) (string, error)

func (*USDMarginedMarketStreamClient) GetListeners

func (u *USDMarginedMarketStreamClient) GetListeners(event string, argument any) *emission.Emitter

func (*USDMarginedMarketStreamClient) GetMarkPriceTopic

func (u *USDMarginedMarketStreamClient) GetMarkPriceTopic(param *MarkPriceTopicParam) (string, error)

func (*USDMarginedMarketStreamClient) GetMiniTickerTopic

func (u *USDMarginedMarketStreamClient) GetMiniTickerTopic(symbol string) (string, error)

func (*USDMarginedMarketStreamClient) GetTickerTopic

func (u *USDMarginedMarketStreamClient) GetTickerTopic(symbol string) (string, error)

func (*USDMarginedMarketStreamClient) IsConnected

func (u *USDMarginedMarketStreamClient) IsConnected() bool

IsConnected returns the WebSocket connection state

func (*USDMarginedMarketStreamClient) Open

func (*USDMarginedMarketStreamClient) RemoveListener

func (u *USDMarginedMarketStreamClient) RemoveListener(event string, listener Listener) *emission.Emitter

func (*USDMarginedMarketStreamClient) Subscribe

func (u *USDMarginedMarketStreamClient) Subscribe(topics []string) error

func (*USDMarginedMarketStreamClient) UnSubscribe

func (u *USDMarginedMarketStreamClient) UnSubscribe(topics []string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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