kucoin

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KucoinDetails = types.ExchangeQueryDetails{
		Exchange:      exchange_common.EXCHANGE_ID_KUCOIN,
		Url:           "https://api.kucoin.com/api/v1/market/allTickers",
		PriceFunction: KucoinPriceFunction,
		IsMultiMarket: true,
	}
)

Functions

func KucoinPriceFunction

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

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

Types

type KucoinResponseBody

type KucoinResponseBody struct {
	Code string             `json:"code" validate:"required"`
	Data KucoinResponseData `json:"data" validate:"required"`
}

KucoinResponseBody defines the overall Kucoin response.

type KucoinResponseData

type KucoinResponseData struct {
	Tickers []KucoinTicker `json:"ticker" validate:"required"`
}

KucoinResponseData defines the `data` field of Kucoin response.

type KucoinTicker

type KucoinTicker struct {
	Pair      string `json:"symbol" validate:"required"`
	AskPrice  string `json:"sell" validate:"required,positive-float-string"`
	BidPrice  string `json:"buy" validate:"required,positive-float-string"`
	LastPrice string `json:"last" validate:"required,positive-float-string"`
}

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

func (KucoinTicker) GetAskPrice

func (t KucoinTicker) GetAskPrice() string

func (KucoinTicker) GetBidPrice

func (t KucoinTicker) GetBidPrice() string

func (KucoinTicker) GetLastPrice

func (t KucoinTicker) GetLastPrice() string

func (KucoinTicker) GetPair

func (t KucoinTicker) GetPair() string

Jump to

Keyboard shortcuts

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