mexc

package
v0.0.0-...-cc24d94 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MexcDetails = types.ExchangeQueryDetails{
		Exchange:      exchange_common.EXCHANGE_ID_MEXC,
		Url:           "https://www.mexc.com/open/api/v2/market/ticker",
		PriceFunction: MexcPriceFunction,
		IsMultiMarket: true,
	}
)

Functions

func MexcPriceFunction

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

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

Types

type MexcResponseBody

type MexcResponseBody struct {
	Code    uint32       `json:"code" validate:"required"`
	Tickers []MexcTicker `json:"data" validate:"required"`
}

MexcResponseBody defines the overall Mexc response.

type MexcTicker

type MexcTicker struct {
	Pair      string `json:"symbol" validate:"required"`
	AskPrice  string `json:"ask" validate:"required,positive-float-string"`
	BidPrice  string `json:"bid" validate:"required,positive-float-string"`
	LastPrice string `json:"last" validate:"required,positive-float-string"`
}

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

func (MexcTicker) GetAskPrice

func (t MexcTicker) GetAskPrice() string

func (MexcTicker) GetBidPrice

func (t MexcTicker) GetBidPrice() string

func (MexcTicker) GetLastPrice

func (t MexcTicker) GetLastPrice() string

func (MexcTicker) GetPair

func (t MexcTicker) GetPair() string

Jump to

Keyboard shortcuts

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