Documentation ¶
Index ¶
- Constants
- type AnyMessage
- type DepthTopicParam
- type KlineTopicParam
- type Listener
- type MBPDepthRefreshTopicParam
- type MBPDepthUpdateTopicParam
- type MarketWsClient
- func (m *MarketWsClient) AddListener(event string, listener Listener) *emission.Emitter
- func (m *MarketWsClient) Close() error
- func (m *MarketWsClient) GetBBOTopic(symbol string) (string, error)
- func (m *MarketWsClient) GetDepthTopic(params *DepthTopicParam) (string, error)
- func (m *MarketWsClient) GetKlineTopic(params *KlineTopicParam) (string, error)
- func (m *MarketWsClient) GetListeners(event string, argument any) *emission.Emitter
- func (m *MarketWsClient) GetMBPDepthUpdateTopic(params *MBPDepthUpdateTopicParam) (string, error)
- func (m *MarketWsClient) GetMBPRefreshDepthTopic(params *MBPDepthRefreshTopicParam) (string, error)
- func (m *MarketWsClient) GetMarketTradeTopic(symbol string) (string, error)
- func (m *MarketWsClient) GetTickerTopic(symbol string) (string, error)
- func (m *MarketWsClient) IsConnected() bool
- func (m *MarketWsClient) Open() error
- func (m *MarketWsClient) RemoveListener(event string, listener Listener) *emission.Emitter
- func (m *MarketWsClient) Subscribe(topic string) error
- func (m *MarketWsClient) UnSubscribe(topic string) error
- type MarketWsClientCfg
- type PingMessage
- type PongMessage
- type Request
- type Response
- type SubscribedMessage
Constants ¶
View Source
const ( GlobalWsBaseURL = "wss://api.huobi.pro/ws" GlobalWsBaseURLForAWS = "wss://api-aws.huobi.pro/ws" MBPWsBaseURL = "wss://api.huobi.pro/feed" MBPWsBaseURLForAWS = "wss://api-aws.huobi.pro/feed" )
View Source
const ( MaxTryTimes = 5 TimerIntervalSecond = 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnyMessage ¶
type AnyMessage struct { Ping *PingMessage Response *Response SubscribedMessage *SubscribedMessage }
AnyMessage represents either a JSON Response or SubscribedMessage.
func (AnyMessage) MarshalJSON ¶
func (m AnyMessage) MarshalJSON() ([]byte, error)
func (*AnyMessage) UnmarshalJSON ¶
func (m *AnyMessage) UnmarshalJSON(data []byte) error
type DepthTopicParam ¶
type KlineTopicParam ¶
type KlineTopicParam struct { Symbol string `validate:"required"` Interval spottypes.KlineInterval `validate:"required,oneof=1min 5min 15min 30min 60min 4hour 1day 1mon 1week 1year"` }
type MarketWsClient ¶
type MarketWsClient struct {
// contains filtered or unexported fields
}
func NewMarketWsClient ¶
func NewMarketWsClient(cfg *MarketWsClientCfg) (*MarketWsClient, error)
func (*MarketWsClient) AddListener ¶
func (m *MarketWsClient) AddListener(event string, listener Listener) *emission.Emitter
func (*MarketWsClient) Close ¶
func (m *MarketWsClient) Close() error
func (*MarketWsClient) GetBBOTopic ¶
func (m *MarketWsClient) GetBBOTopic(symbol string) (string, error)
func (*MarketWsClient) GetDepthTopic ¶
func (m *MarketWsClient) GetDepthTopic(params *DepthTopicParam) (string, error)
func (*MarketWsClient) GetKlineTopic ¶
func (m *MarketWsClient) GetKlineTopic(params *KlineTopicParam) (string, error)
func (*MarketWsClient) GetListeners ¶
func (m *MarketWsClient) GetListeners(event string, argument any) *emission.Emitter
func (*MarketWsClient) GetMBPDepthUpdateTopic ¶
func (m *MarketWsClient) GetMBPDepthUpdateTopic(params *MBPDepthUpdateTopicParam) (string, error)
func (*MarketWsClient) GetMBPRefreshDepthTopic ¶
func (m *MarketWsClient) GetMBPRefreshDepthTopic(params *MBPDepthRefreshTopicParam) (string, error)
func (*MarketWsClient) GetMarketTradeTopic ¶
func (m *MarketWsClient) GetMarketTradeTopic(symbol string) (string, error)
func (*MarketWsClient) GetTickerTopic ¶
func (m *MarketWsClient) GetTickerTopic(symbol string) (string, error)
func (*MarketWsClient) IsConnected ¶
func (m *MarketWsClient) IsConnected() bool
IsConnected returns the WebSocket connection state
func (*MarketWsClient) Open ¶
func (m *MarketWsClient) Open() error
func (*MarketWsClient) RemoveListener ¶
func (m *MarketWsClient) RemoveListener(event string, listener Listener) *emission.Emitter
func (*MarketWsClient) Subscribe ¶
func (m *MarketWsClient) Subscribe(topic string) error
func (*MarketWsClient) UnSubscribe ¶
func (m *MarketWsClient) UnSubscribe(topic string) error
type MarketWsClientCfg ¶
type PingMessage ¶
type PingMessage struct {
Ping int64 `json:"ping,omitempty"`
}
type PongMessage ¶
type PongMessage struct {
Pong int64 `json:"pong,omitempty"`
}
type SubscribedMessage ¶
type SubscribedMessage struct { Channel string `json:"ch,omitempty"` Ts int64 `json:"ts,omitempty"` Data json.RawMessage `json:"tick"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.