Documentation ¶
Overview ¶
Package coinbase defines the connectivity with Coinbase Exchange.
Index ¶
Constants ¶
View Source
const ( WebSocketURL = "wss://ws-feed.exchange.coinbase.com" WebSocketRequestsPerSecond = 10 )
Connection parameters for Coinbase Exchange. These are only provided for convenience in testing - operational values should be in the environment.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection wraps a Coinbase websocket connection.
func Factory ¶
func Factory( url string, symbol string, onQuote func(*mkt.Quote), onTrade func(*mkt.Trade), onError func(error), limiter *utl.RateLimiter, lifetime time.Duration, ) *Connection
Factory is the [dma.ConnectionFactory] for a Connection.
type MessageType ¶
type MessageType struct { Type string `json:"type"` // Values are "ticker" or "error". Message string `json:"message"` // Present when type is "error". }
MessageType is a minimal Coinbase Exchange websocket message.
type Request ¶
type Request struct { Type string `json:"type"` ProductIDs []string `json:"product_ids"` Channels []string `json:"channels"` }
Request is a Coinbase Exchange websocket request.
type Ticker ¶
type Ticker struct { Symbol string `json:"product_id"` BidPx string `json:"best_bid"` BidSize string `json:"best_bid_size"` AskPx string `json:"best_ask"` AskSize string `json:"best_ask_size"` LastQty string `json:"last_size"` LastPx string `json:"price"` TradeID int64 `json:"trade_id"` }
Ticker is a Coinbase Exchange websocket ticker message.
Click to show internal directories.
Click to hide internal directories.