okx

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OkxDetails = types.ExchangeQueryDetails{
		Exchange:      exchange_common.EXCHANGE_ID_OKX,
		Url:           "https://www.okx.com/api/v5/market/tickers?instType=SPOT",
		PriceFunction: OkxPriceFunction,
		IsMultiMarket: true,
	}
)

Functions

func OkxPriceFunction

func OkxPriceFunction(
	response *http.Response,
	marketPriceExponent map[string]int32,
	medianizer lib.Medianizer,
) (tickerToPrice map[string]uint64, unavailableTickers map[string]error, err error)

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

Types

type OkxResponseBody

type OkxResponseBody struct {
	Code    string      `json:"code" validate:"required"`
	Tickers []OkxTicker `json:"data" validate:"required"`
}

OkxResponseBody defines the overall Okx response.

type OkxTicker

type OkxTicker struct {
	Pair      string `json:"instId" validate:"required"`
	AskPrice  string `json:"askPx" validate:"required,positive-float-string"`
	BidPrice  string `json:"bidPx" validate:"required,positive-float-string"`
	LastPrice string `json:"last" validate:"required,positive-float-string"`
}

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

func (OkxTicker) GetAskPrice

func (t OkxTicker) GetAskPrice() string

func (OkxTicker) GetBidPrice

func (t OkxTicker) GetBidPrice() string

func (OkxTicker) GetLastPrice

func (t OkxTicker) GetLastPrice() string

func (OkxTicker) GetPair

func (t OkxTicker) GetPair() string

Jump to

Keyboard shortcuts

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