coinbase_pro

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CoinbaseProDetails = types.ExchangeQueryDetails{
		Exchange:      exchange_common.EXCHANGE_ID_COINBASE_PRO,
		Url:           "https://api.pro.coinbase.com/products/$/ticker",
		PriceFunction: CoinbaseProPriceFunction,
	}
)

Functions

func CoinbaseProPriceFunction

func CoinbaseProPriceFunction(
	response *http.Response,
	tickerToExponent map[string]int32,
	resolver types.Resolver,
) (tickerToPrice map[string]uint64, unavailableTickers map[string]error, err error)

CoinbaseProPriceFunction transforms an API response from CoinbasePro into a map of tickers to prices that have been shifted by a market specific exponent.

Types

type CoinbaseProTicker

type CoinbaseProTicker struct {
	// `Pair` is not part of API response but can be set manually to reuse existing helper functions.
	Pair      string `validate:"required"`
	AskPrice  string `json:"ask" validate:"required,positive-float-string"`
	BidPrice  string `json:"bid" validate:"required,positive-float-string"`
	LastPrice string `json:"price" validate:"required,positive-float-string"`
}

CoinbaseProTicker is our representation of ticker information returned in CoinbasePro response. CoinbaseProTicker implements interface `Ticker` in util.go.

func (CoinbaseProTicker) GetAskPrice

func (t CoinbaseProTicker) GetAskPrice() string

func (CoinbaseProTicker) GetBidPrice

func (t CoinbaseProTicker) GetBidPrice() string

func (CoinbaseProTicker) GetLastPrice

func (t CoinbaseProTicker) GetLastPrice() string

func (CoinbaseProTicker) GetPair

func (t CoinbaseProTicker) GetPair() string

Jump to

Keyboard shortcuts

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