bybit

package
v0.0.0-...-baf6593 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BybitDetails = types.ExchangeQueryDetails{
		Exchange:      exchange_common.EXCHANGE_ID_BYBIT,
		Url:           "https://api.bybit.com/v5/market/tickers?category=spot",
		PriceFunction: BybitPriceFunction,
		IsMultiMarket: true,
	}
)

Functions

func BybitPriceFunction

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

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

Types

type BybitResponseBody

type BybitResponseBody struct {
	RetCode uint32              `json:"retCode" validate:"required"`
	Result  BybitResponseResult `json:"result" validate:"required"`
}

BybitResponseBody defines the overall Bybit response.

type BybitResponseResult

type BybitResponseResult struct {
	Tickers []BybitTicker `json:"list" validate:"required"`
}

BybitResponseResult defines the `result` field of Bybit response.

type BybitTicker

type BybitTicker struct {
	Pair      string `json:"symbol" validate:"required"`
	AskPrice  string `json:"ask1Price" validate:"required,positive-float-string"`
	BidPrice  string `json:"bid1Price" validate:"required,positive-float-string"`
	LastPrice string `json:"lastPrice" validate:"required,positive-float-string"`
}

BybitTicker is our representation of ticker information returned in Bybit response. It implements the Ticker interface in util.go.

func (BybitTicker) GetAskPrice

func (t BybitTicker) GetAskPrice() string

func (BybitTicker) GetBidPrice

func (t BybitTicker) GetBidPrice() string

func (BybitTicker) GetLastPrice

func (t BybitTicker) GetLastPrice() string

func (BybitTicker) GetPair

func (t BybitTicker) GetPair() string

Jump to

Keyboard shortcuts

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