binance

package
v0.2.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Example request URL: /api/v3/ticker/24hr?symbols=["BTCUSDT","BNBUSDT"]
	BinanceDetails = types.ExchangeQueryDetails{
		Exchange:      exchange_common.EXCHANGE_ID_BINANCE,
		Url:           "https://data.binance.com/api/v3/ticker/24hr?symbols=[$]",
		PriceFunction: BinancePriceFunction,
		IsMultiMarket: true,
	}

	BinanceUSDetails = types.ExchangeQueryDetails{
		Exchange:      exchange_common.EXCHANGE_ID_BINANCE_US,
		Url:           "https://api.binance.us/api/v3/ticker/24hr?symbols=[$]",
		PriceFunction: BinancePriceFunction,
		IsMultiMarket: true,
	}
)

Functions

func BinancePriceFunction

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

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

Types

type BinanceTicker

type BinanceTicker struct {
	Pair      string `json:"symbol" validate:"required"`
	AskPrice  string `json:"askPrice" validate:"required,positive-float-string"`
	BidPrice  string `json:"bidPrice" validate:"required,positive-float-string"`
	LastPrice string `json:"lastPrice" validate:"required,positive-float-string"`
}

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

func (BinanceTicker) GetAskPrice

func (t BinanceTicker) GetAskPrice() string

func (BinanceTicker) GetBidPrice

func (t BinanceTicker) GetBidPrice() string

func (BinanceTicker) GetLastPrice

func (t BinanceTicker) GetLastPrice() string

func (BinanceTicker) GetPair

func (t BinanceTicker) GetPair() string

Jump to

Keyboard shortcuts

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