coinbase

package
v0.0.0-...-056b33b Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: MIT Imports: 11 Imported by: 0

README

Coinbase Data Connector

The Coinbase data connector uses Coinbase Pro exchange data to stream exchange ticker data.

The connector uses the WebSocket Feed and reads real-time price updates every time a match happens for a set of products. It uses the WebSocket ticker channel.

The feed returns data in JSON form, so the connector should be paired with the json data processor.

{
  "type": "ticker",
  "trade_id": 20153558,
  "sequence": 3262786978,
  "time": "2017-09-02T17:05:49.250000Z",
  "product_id": "BTC-USD",
  "price": "4388.01000000",
  "side": "buy", // taker side
  "last_size": "0.03000000",
  "best_bid": "4388",
  "best_ask": "4388.01"
}

Supported parameters

  • product_ids A comma-delimited list of Coinbase Pro supported product ids. E.g. BTC-USD,ETH-USD.

Example Dataspace

dataspaces:
  - from: coinbase
    name: btcusd
    fields:
      - name: price
      - name: side
        type: tag
      - name: last_size
      - name: best_bid
      - name: best_ask
    data:
      connector:
        name: coinbase
        params:
          product_ids: BTC-USD
      processor:
        name: json

Documentation

Index

Constants

View Source
const (
	CoinbaseConnectorName string = "coinbase"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Name       string   `json:"name"`
	ProductIDS []string `json:"product_ids"`
}

type CoinbaseConnector

type CoinbaseConnector struct {
	// contains filtered or unexported fields
}

func NewCoinbaseConnector

func NewCoinbaseConnector() *CoinbaseConnector

func (*CoinbaseConnector) Init

func (c *CoinbaseConnector) Init(epoch time.Time, period time.Duration, interval time.Duration, params map[string]string) error

func (*CoinbaseConnector) Read

func (c *CoinbaseConnector) Read(handler func(data []byte, metadata map[string]string) ([]byte, error)) error

type Heartbeat

type Heartbeat struct {
	Type        string `json:"type"`
	LastTradeID int64  `json:"last_trade_id"`
	ProductID   string `json:"product_id"`
	Sequence    int64  `json:"sequence"`
	Time        string `json:"time"`
}

type MessageHeaders

type MessageHeaders struct {
	MessageType string `json:"type,omitempty"`
	Sequence    *int   `sequence:"type,omitempty"`
}

type SubscribeRequest

type SubscribeRequest struct {
	RequestType string   `json:"type,omitempty"`
	ProductIds  []string `json:"product_ids,omitempty"`
	Channels    []string `json:"channels,omitempty"`
}

type Subscriptions

type Subscriptions struct {
	Type     string    `json:"type"`
	Channels []Channel `json:"channels"`
}

Jump to

Keyboard shortcuts

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