Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ticker ¶
type Ticker struct {
// contains filtered or unexported fields
}
Ticker struct
func (*Ticker) Channel ¶
func (t *Ticker) Channel() <-chan *exchanges.TickerEvent
Channel TickerEvent
type Time ¶
func (Time) MarshalJSON ¶
MarshalJSON marshal time back to time.Time for json encoding
func (*Time) UnmarshalJSON ¶
type WebSocketChannel ¶
type WebSocketChannel struct { Name WebSocketChannelType `json:"name"` Products []*WebSocketProduct `json:"product_ids,omitempty"` }
WebSocketChannel struct
type WebSocketChannelType ¶
type WebSocketChannelType string
const ( WebSocketChannelTypeLevel3 WebSocketChannelType = "level2" WebSocketChannelTypeTicker WebSocketChannelType = "ticker" WebSocketChannelTypeHeartbeat WebSocketChannelType = "heartbeat" WebSocketChannelTypeFull WebSocketChannelType = "full" WebSocketChannelTypeUser WebSocketChannelType = "user" WebSocketChannelTypeMatches WebSocketChannelType = "matches" )
type WebSocketClient ¶
type WebSocketClient struct { Ticker chan *WebSocketTickerResponse // contains filtered or unexported fields }
WebSocketClient struct
func (*WebSocketClient) Connect ¶
func (c *WebSocketClient) Connect() error
Connect to websocket server
func (*WebSocketClient) Subscribe ¶
func (c *WebSocketClient) Subscribe(channels ...*WebSocketChannel) error
Subscribe to channel
func (*WebSocketClient) Unsubscribe ¶
func (c *WebSocketClient) Unsubscribe(channels ...*WebSocketChannel) error
Unsubscribe to channel
type WebSocketEvent ¶
type WebSocketEvent struct {
Type WebSocketEventType `json:"type"`
}
WebSocketEvent struct
type WebSocketEventType ¶
type WebSocketEventType string
const ( WebSocketEventTypeSubscribe WebSocketEventType = "subscribe" WebSocketEventTypeSubscriptions WebSocketEventType = "subscriptions" WebSocketEventTypeError WebSocketEventType = "error" WebSocketEventTypeUnsubscribe WebSocketEventType = "unsubscribe" WebSocketEventTypeOpen WebSocketEventType = "open" WebSocketEventTypeReceived WebSocketEventType = "received" WebSocketEventTypeDone WebSocketEventType = "done" WebSocketEventTypeMatch WebSocketEventType = "match" WebSocketEventTypeChange WebSocketEventType = "change" WebSocketEventTypeActivate WebSocketEventType = "activate" WebSocketEventTypeHeartbeat WebSocketEventType = "heartbeat" WebSocketEventTypeTicker WebSocketEventType = "ticker" WebSocketEventTypeSnapshot WebSocketEventType = "snapshot" WebSocketEventTypeLevel2Update WebSocketEventType = "l2update" WebSocketEventTypeMarginProfileUpdate WebSocketEventType = "margin_profile_update" )
type WebSocketProduct ¶
WebSocketProduct struct
func NewWebSocketProduct ¶
func NewWebSocketProduct(from string, to string) *WebSocketProduct
NewWebSocketProduct create product object
func (WebSocketProduct) MarshalJSON ¶
func (p WebSocketProduct) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler. It will encode null if this time is null.
func (WebSocketProduct) String ¶
func (p WebSocketProduct) String() string
func (*WebSocketProduct) UnmarshalJSON ¶
func (p *WebSocketProduct) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler. It support string and null input.
type WebSocketSubscribeRequest ¶
type WebSocketSubscribeRequest struct { *WebSocketEvent Channels []*WebSocketChannel `json:"channels"` }
WebSocketSubscribeRequest struct
type WebSocketTickerResponse ¶
type WebSocketTickerResponse struct { *WebSocketEvent TradeID int `json:"trade_id"` Sequence int `json:"sequence"` Product *WebSocketProduct `json:"product_id"` Price string `json:"price"` Side string `json:"side"` LastSize string `json:"last_size"` BestBid string `json:"best_bid"` BestAsk string `json:"best_ask"` Time Time `json:"time"` }
WebSocketTickerResponse struct
Click to show internal directories.
Click to hide internal directories.