bitfinex

package
v0.0.0-...-a9c8dba Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PairIndex      = 0
	BidPriceIndex  = 1
	AskPriceIndex  = 3
	LastPriceIndex = 7
	// We don't need all 11 fields, but 11 fields indicates this is a valid API response. See above link
	// for documentation on the response format.
	BitfinexResponseLength = 11
)

These indices into the REST API response are defined in https://docs.bitfinex.com/reference/rest-public-tickers

Variables

View Source
var (
	BitfinexDetails = types.ExchangeQueryDetails{
		Exchange:      exchange_common.EXCHANGE_ID_BITFINEX,
		Url:           "https://api-pub.bitfinex.com/v2/tickers?symbols=ALL",
		PriceFunction: BitfinexPriceFunction,
		IsMultiMarket: true,
	}
)

Functions

func BitfinexPriceFunction

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

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

Types

type BitfinexTicker

type BitfinexTicker struct {
	Pair      string `validate:"required"`
	BidPrice  string `validate:"required,positive-float-string"`
	AskPrice  string `validate:"required,positive-float-string"`
	LastPrice string `validate:"required,positive-float-string"`
}

BitfinexTicker is our representation of the ticker information in Bitfinex API response. The raw response is a slice of floats. We use this constructed response to enable stricter validation. BitfinexTicker implements interface `Ticker` in util.go.

func (BitfinexTicker) GetAskPrice

func (t BitfinexTicker) GetAskPrice() string

func (BitfinexTicker) GetBidPrice

func (t BitfinexTicker) GetBidPrice() string

func (BitfinexTicker) GetLastPrice

func (t BitfinexTicker) GetLastPrice() string

func (BitfinexTicker) GetPair

func (t BitfinexTicker) GetPair() string

Jump to

Keyboard shortcuts

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