kraken

package
v0.0.0-...-baf6593 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KrakenDetails = types.ExchangeQueryDetails{
		Exchange:      exchange_common.EXCHANGE_ID_KRAKEN,
		Url:           "https://api.kraken.com/0/public/Ticker",
		PriceFunction: KrakenPriceFunction,
		IsMultiMarket: true,
	}
)

Functions

func KrakenPriceFunction

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

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

Types

type KrakenResponseBody

type KrakenResponseBody struct {
	// As of this time, the Kraken API response is all-or-nothing - either valid ticker data, or one or more errors,
	// but not both. We enforce this expectation by defining mutual exclusivity in the validation tags of the Errors
	// field so that any validated API result always meets our expectation in the response parsing logic.
	Errors  []string                      `json:"error" validate:"omitempty"`
	Tickers map[string]KrakenTickerResult `validate:"required_without=Errors,excluded_with=Errors,dive" json:"result"`
}

type KrakenTickerResult

type KrakenTickerResult struct {
	AskPriceStats   []string `json:"a" validate:"len=3,dive,positive-float-string"`
	BidPriceStats   []string `json:"b" validate:"len=3,dive,positive-float-string"`
	ClosePriceStats []string `json:"c" validate:"len=2,dive,positive-float-string"`
	// contains filtered or unexported fields
}

https://api.kraken.com/0/public/Ticker https://docs.kraken.com/rest/#tag/Market-Data/operation/getTickerInformation KrakenTickerResult is the result of a Kraken API call for a single ticker. KrakentickerResult implements the types.TickerResult interface in util.go.

func (KrakenTickerResult) GetAskPrice

func (ktr KrakenTickerResult) GetAskPrice() string

func (KrakenTickerResult) GetBidPrice

func (ktr KrakenTickerResult) GetBidPrice() string

func (KrakenTickerResult) GetLastPrice

func (ktr KrakenTickerResult) GetLastPrice() string

func (KrakenTickerResult) GetPair

func (ktr KrakenTickerResult) GetPair() string

func (KrakenTickerResult) WithPair

func (ktr KrakenTickerResult) WithPair(pair string) KrakenTickerResult

Jump to

Keyboard shortcuts

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