client

package
v0.0.0-...-ac4ccac Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMarketDataEndpoint = "wss://advanced-trade-ws.coinbase.com"
View Source
var DefaultSuccessHttpStatusCodes = []int{http.StatusOK}
View Source
var DefaultUserOrderDataEndpoint = "wss://advanced-trade-ws-user.coinbase.com"

Functions

func AddAdvancedHttpHeaders

func AddAdvancedHttpHeaders(req *http.Request, path string, body []byte, cl core.RestClient, t time.Time)

func DefaultDialerConfig

func DefaultDialerConfig(url string) core.DialerConfig

func DefaultHttpClient

func DefaultHttpClient() (http.Client, error)

Types

type RestClient

type RestClient interface {
	SetHttpBaseUrl(u string) RestClient
	HttpBaseUrl() string
	HttpClient() *http.Client
	Credentials() *credentials.Credentials
	SetHeadersFunc(hf core.HttpHeaderFunc) RestClient
	HeadersFunc() core.HttpHeaderFunc
}

func NewRestClient

func NewRestClient(credentials *credentials.Credentials, httpClient http.Client) RestClient

type WebSocketClient

type WebSocketClient interface {
	// Dial establishes the WebSocket connection using the underlying
	// DialerConfig.
	Dial(ctx context.Context) error

	// Close closes the WebSocket connection.
	Close() error

	// Subscribe sends a subscription request for one or more
	// channels (e.g., "ticker", "level2", "user", etc.).
	Subscribe(request model.SocketRequest) error

	// Listen continuously reads messages from the WebSocket
	// connection, passing each message to the provided handler.
	// It blocks until the context is cancelled or an error occurs.
	Listen(ctx context.Context, handleMessage core.OnWebSocketTextMessage) <-chan error
}

func NewWebSocketClient

func NewWebSocketClient(cfg core.DialerConfig) WebSocketClient

Jump to

Keyboard shortcuts

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