huobi

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 (
	HuobiDetails = types.ExchangeQueryDetails{
		Exchange:      exchange_common.EXCHANGE_ID_HUOBI,
		Url:           "https://api.huobi.pro/market/tickers",
		PriceFunction: HuobiPriceFunction,
		IsMultiMarket: true,
	}
)

Functions

func HuobiPriceFunction

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

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

Types

type HuobiResponseBody

type HuobiResponseBody struct {
	Status  string        `json:"status" validate:"required"`
	Tickers []HuobiTicker `json:"data" validate:"required"`
}

HuobiResponseBody defines the overall Huobi response.

type HuobiTicker

type HuobiTicker struct {
	Pair      string  `json:"symbol" validate:"required"`
	AskPrice  float64 `json:"ask" validate:"required,gt=0"`
	BidPrice  float64 `json:"bid" validate:"required,gt=0"`
	LastPrice float64 `json:"close" validate:"required,gt=0"`
}

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

func (HuobiTicker) GetAskPrice

func (t HuobiTicker) GetAskPrice() string

func (HuobiTicker) GetBidPrice

func (t HuobiTicker) GetBidPrice() string

func (HuobiTicker) GetLastPrice

func (t HuobiTicker) GetLastPrice() string

func (HuobiTicker) GetPair

func (t HuobiTicker) GetPair() string

Jump to

Keyboard shortcuts

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