asset

package
v0.0.0-...-005975c Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 5 Imported by: 273

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 = iota
	Spot
	Margin
	CrossMargin
	MarginFunding
	Index
	Binary
	Futures
	PerpetualContract
	PerpetualSwap
	DeliveryFutures
	UpsideProfitContract
	DownsideProfitContract
	CoinMarginedFutures
	USDTMarginedFutures
	USDCMarginedFutures
	FutureCombo
	LinearContract
	Spread
	Options
	OptionCombo
	// All asset const must come immediately after all valid assets for method `IsValid`
	All
)

Supported Assets

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

func (a Item) IsCoinMargined() bool

IsCoinMargined checks if the futures asset type is coin margined

func (Item) IsDerivative

func (a Item) IsDerivative() bool

IsDerivative checks if the asset type is a futures or options contract based asset

func (Item) IsFunding

func (a Item) IsFunding() bool

IsFunding checks if the asset type is used for funding markets

func (Item) IsFutures

func (a Item) IsFutures() bool

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

func (Item) IsMargin

func (a Item) IsMargin() bool

IsMargin checks if the asset type is margin trading based

func (Item) IsMultiLeg

func (a Item) IsMultiLeg() bool

IsMultiLeg checks if the asset type requires multi-leg handling

func (Item) IsOptions

func (a Item) IsOptions() bool

IsOptions checks if the asset type is options contract based asset

func (Item) IsStablecoinMargined

func (a Item) IsStablecoinMargined() bool

IsStablecoinMargined checks if the futures asset type is margined by a stablecoin

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 unmarshaler interface

func (Item) Upper

func (a Item) Upper() string

Upper returns the item's upper case string

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