asset

package
v0.0.0-...-095394f Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 4 Imported by: 273

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotSupported is an error for an unsupported asset type
	ErrNotSupported = errors.New("unsupported asset type")
	// ErrNotEnabled is an error for an asset not enabled
	ErrNotEnabled = errors.New("asset type not enabled")
	// ErrInvalidAsset is returned when the assist isn't valid
	ErrInvalidAsset = errors.New("asset is invalid")
)

Functions

This section is empty.

Types

type Item

type Item uint32

Item stores the asset type

const (
	Empty Item = 0
	Spot  Item = 1 << iota
	Margin
	CrossMargin
	MarginFunding
	Index
	Binary
	PerpetualContract
	PerpetualSwap
	Futures
	DeliveryFutures
	UpsideProfitContract
	DownsideProfitContract
	CoinMarginedFutures
	USDTMarginedFutures
	USDCMarginedFutures
	Options

	// Added to represent a USDT and USDC based linear derivatives(futures/perpetual) assets in Bybit V5.
	LinearContract
)

Const vars for asset package

func New

func New(input string) (Item, error)

New takes an input matches to relevant package assets

func UseDefault

func UseDefault() Item

UseDefault returns default asset type

func (Item) IsFutures

func (a Item) IsFutures() bool

IsFutures checks if the asset type is a futures contract based asset

func (Item) IsValid

func (a Item) IsValid() bool

IsValid returns whether or not the supplied asset type is valid or not

func (Item) MarshalJSON

func (a Item) MarshalJSON() ([]byte, error)

MarshalJSON comforms type to the marshaller interface

func (Item) String

func (a Item) String() string

String converts an Item to its string representation

func (*Item) UnmarshalJSON

func (a *Item) UnmarshalJSON(d []byte) error

UnmarshalJSON comforms type to the umarshaler interface

type Items

type Items []Item

Items stores a list of assets types

func Supported

func Supported() Items

Supported returns a list of supported asset types

func (Items) Contains

func (a Items) Contains(i Item) bool

Contains returns whether or not the supplied asset exists in the list of Items

func (Items) JoinToString

func (a Items) JoinToString(separator string) string

JoinToString joins an asset type array and converts it to a string with the supplied separator

func (Items) Strings

func (a Items) Strings() []string

Strings converts an asset type array to a string array

Jump to

Keyboard shortcuts

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