Documentation ¶
Index ¶
- type AccountEventHandler
- type Action
- type AuthEvent
- type BaseEvent
- type BookEvent
- type CandlesEvent
- type CandlesEventHandler
- type Channel
- type ChannelName
- type EventHandler
- type FillEvent
- type Option
- type OrderEvent
- type Ticker24hEvent
- type TickerEvent
- type TradesEvent
- type WebSocketMessage
- type WsClient
- type WsEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountEventHandler ¶
type AccountEventHandler interface { // Subscribe to markets. // You can set the buffSize for the channel. // If you have many subscriptions at once you may need to increase the buffSize // Default buffSize: 50 Subscribe(markets []string, buffSize ...uint64) (<-chan OrderEvent, <-chan FillEvent, error) // Unsubscribe from markets. Unsubscribe(markets []string) error // Unsubscribe from every market. UnsubscribeAll() error }
type BaseEvent ¶
type BaseEvent struct {
Event WsEvent `json:"event"`
}
func (*BaseEvent) UnmarshalJSON ¶ added in v2.7.5
type BookEvent ¶
type BookEvent struct { // Describes the returned event over the socket. Event string `json:"event"` // The market which was requested in the subscription. Market string `json:"market"` // The book containing the bids and asks. Book types.Book `json:"book"` }
func (*BookEvent) UnmarshalJSON ¶
type CandlesEvent ¶
type CandlesEvent struct { // Describes the returned event over the socket. Event string `json:"event"` // The market which was requested in the subscription. Market string `json:"market"` // The interval which was requested in the subscription. Interval string `json:"interval"` // The candle in the defined time period. Candle types.Candle `json:"candle"` }
func (*CandlesEvent) UnmarshalJSON ¶
func (c *CandlesEvent) UnmarshalJSON(bytes []byte) error
type CandlesEventHandler ¶
type CandlesEventHandler interface { // Subscribe to markets with interval. // You can set the buffSize for this channel. // // If you have many subscriptions at once you may need to increase the buffSize // // Default buffSize: 50 Subscribe(markets []string, interval string, buffSize ...uint64) (<-chan CandlesEvent, error) // Unsubscribe from markets with interval Unsubscribe(markets []string, interval string) error // Unsubscribe from every market with interval UnsubscribeAll() error }
type ChannelName ¶
type EventHandler ¶
type EventHandler[T any] interface { // Subscribe to markets. // You can set the buffSize for the channel. // // If you have many subscriptions at once you may need to increase the buffSize // // Default buffSize: 50 Subscribe(markets []string, buffSize ...uint64) (<-chan T, error) // Unsubscribe from markets. Unsubscribe(markets []string) error // Unsubscribe from every market. UnsubscribeAll() error }
type FillEvent ¶
type FillEvent struct { // Describes the returned event over the socket Event string `json:"event"` // The market which was requested in the subscription Market string `json:"market"` // The fill itself Fill types.Fill `json:"fill"` }
func (*FillEvent) UnmarshalJSON ¶
type Option ¶
type Option func(*wsClient)
func WithAutoReconnect ¶
Auto reconnect if websocket disconnects. default: true
func WithErrorChannel ¶
Receive websocket connection errors (e.g. reconnect error, auth error, write failed, read failed)
func WithWriteBuffSize ¶
The buff size for the write channel, by default the write channel is unbuffered. The write channel writes messages to the websocket.
type OrderEvent ¶
type OrderEvent struct { // Describes the returned event over the socket. Event string `json:"event"` // The market which was requested in the subscription. Market string `json:"market"` // The order itself. Order types.Order `json:"order"` }
func (*OrderEvent) UnmarshalJSON ¶
func (o *OrderEvent) UnmarshalJSON(bytes []byte) error
type Ticker24hEvent ¶
type Ticker24hEvent struct { // Describes the returned event over the socket. Event string `json:"event"` // The market which was requested in the subscription. Market string `json:"market"` // The ticker24h containing the prices etc. Ticker24h types.Ticker24h `json:"ticker24h"` }
func (*Ticker24hEvent) UnmarshalJSON ¶
func (t *Ticker24hEvent) UnmarshalJSON(bytes []byte) error
type TickerEvent ¶
type TickerEvent struct { // Describes the returned event over the socket. Event string `json:"event"` // The market which was requested in the subscription. Market string `json:"market"` // The ticker containing the prices. Ticker types.Ticker `json:"ticker"` }
func (*TickerEvent) UnmarshalJSON ¶
func (t *TickerEvent) UnmarshalJSON(bytes []byte) error
type TradesEvent ¶
type TradesEvent struct { // Describes the returned event over the socket. Event string `json:"event"` // The market which was requested in the subscription. Market string `json:"market"` // The trade containing the price, side etc. Trade types.Trade `json:"trade"` }
func (*TradesEvent) UnmarshalJSON ¶
func (t *TradesEvent) UnmarshalJSON(bytes []byte) error
type WebSocketMessage ¶
type WebSocketMessage struct { Action string `json:"action"` Channels []Channel `json:"channels,omitempty"` // Api Key. Key string `json:"key,omitempty"` // SHA256 HMAC hex digest of timestamp + method + url + body. Signature string `json:"signature,omitempty"` // The current timestamp in milliseconds since 1 Jan 1970. Timestamp int64 `json:"timestamp,omitempty"` }
type WsClient ¶
type WsClient interface { // Close everything, including subscriptions, underlying websockets, graceful shutdown... Close() error // Candles event handler to handle candle events and subscriptions. Candles() CandlesEventHandler // Ticker event handler to handle ticker events and subscriptions. Ticker() EventHandler[TickerEvent] // Ticker24h event handler to handle ticker24h events and subscriptions. Ticker24h() EventHandler[Ticker24hEvent] // Trades event handler to handle trade events and subscriptions. Trades() EventHandler[TradesEvent] // Book event handler to handle book events and subscriptions. Book() EventHandler[BookEvent] // Account event handler to handle order/fill events, requires authentication. Account(apiKey string, apiSecret string) AccountEventHandler }
func NewWsClient ¶
Click to show internal directories.
Click to hide internal directories.