binance

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BinanceDetails = types.ExchangeQueryDetails{
		Exchange:      exchange_common.EXCHANGE_ID_BINANCE,
		Url:           "https://data-api.binance.vision/api/v3/ticker/24hr",
		PriceFunction: BinancePriceFunction,
		IsMultiMarket: true,
	}

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

Functions

func BinancePriceFunction

func BinancePriceFunction(
	response *http.Response,
	tickerToExponent map[string]int32,
	resolver types.Resolver,
) (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. It 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