asset

package
v0.0.0-...-1fab9c7 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 4 Imported by: 274

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSupported = errors.New("unsupported asset type")
	ErrNotEnabled   = errors.New("asset type not enabled")
	ErrInvalidAsset = errors.New("asset is invalid")
)

Public errors related to assets

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
	OptionCombo
	FutureCombo
	LinearContract // Added to represent a USDT and USDC based linear derivatives(futures/perpetual) assets in Bybit V5
	All
)

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) IsOptions

func (a Item) IsOptions() bool

IsOptions checks if the asset type is options 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 conforms 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 conforms 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