coinbase

package
v0.0.0-...-99e30f2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultURL = "wss://ws-feed.exchange.coinbase.com"

Variables

This section is empty.

Functions

func NewClient

func NewClient(url string) (websocket.Client, error)

NewClient returns a new websocket client.

Types

type Channel

type Channel struct {
	Name       ChannelType
	ProductIDs []string
}

type ChannelType

type ChannelType string

ChannelType represents the type of channel on Coinbase.

const (
	ChannelTypeLevel2    ChannelType = "level2"
	ChannelTypeHeartBeat ChannelType = "heartbeat"
	ChannelTypeTicker    ChannelType = "ticker"
	ChannelTypeMatches   ChannelType = "matches"
)

type Request

type Request struct {
	Type       RequestType `json:"type"`
	ProductIDs []string    `json:"product_ids"`
	Channels   []Channel   `json:"channels"`
}

Request is a request to be sent to the Coinbase websocket.

type RequestType

type RequestType string

RequestType represents the type of request.

const (
	RequestTypeSubscribe     RequestType = "subscribe"
	RequestTypeUnsubscribe   RequestType = "unsubscribe"
	RequestTypeSubscriptions RequestType = "subscriptions"
	RequestTypeError         RequestType = "error"
)

type Response

type Response struct {
	Type      string    `json:"type"`
	Channels  []Channel `json:"channels"`
	Message   string    `json:"message,omitempty"`
	Size      string    `json:"size"`
	Price     string    `json:"price"`
	ProductID string    `json:"product_id"`
}

Response is the response received after a request submission.

Jump to

Keyboard shortcuts

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