types

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AssetBits int = 24
View Source
const MarketBits int = 2 * AssetBits

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(b []byte) string

BytesToString converts a byte slice to a string without allocation

Types

type AssetID

type AssetID uint32

func (AssetID) ID

func (a AssetID) ID() uint32

type AssetMap

type AssetMap map[string]AssetID

func (AssetMap) Add

func (am AssetMap) Add(id AssetID, name string)

func (AssetMap) MarketID

func (am AssetMap) MarketID(sell, buy string) (MarketID, bool)

type ExchangeID

type ExchangeID uint16

func (ExchangeID) ID

func (e ExchangeID) ID() uint16

type ExchangeMarketID

type ExchangeMarketID uint64

func ExchangeMarket

func ExchangeMarket(exchange uint16, id uint32) ExchangeMarketID

func ExchangeMarketByAssets

func ExchangeMarketByAssets(exchange uint16, sell, buy AssetID) ExchangeMarketID

func (ExchangeMarketID) Buy

func (m ExchangeMarketID) Buy() AssetID

func (ExchangeMarketID) Exchange

func (m ExchangeMarketID) Exchange() ExchangeID

func (ExchangeMarketID) ID

func (m ExchangeMarketID) ID() uint64

func (ExchangeMarketID) Market

func (m ExchangeMarketID) Market() MarketID

func (ExchangeMarketID) Revert

func (ExchangeMarketID) Sell

func (m ExchangeMarketID) Sell() AssetID

type IMarketAdapter

type IMarketAdapter interface {
	MarketID(sell, buy string) (MarketID, bool)
}

type Market

type Market struct {
	Name      string
	Precision float64
}

type MarketID

type MarketID uint64

func NewMarket

func NewMarket(sell, buy AssetID) (res MarketID)

func (MarketID) Buy

func (m MarketID) Buy() AssetID

func (MarketID) ID

func (m MarketID) ID() uint32

func (MarketID) Revert

func (m MarketID) Revert() (res MarketID)

func (MarketID) Sell

func (m MarketID) Sell() AssetID

type Price

type Price [2]float64

type StringToFloat

type StringToFloat float64

func (StringToFloat) Float

func (foe StringToFloat) Float() float64

func (*StringToFloat) UnmarshalJSON

func (foe *StringToFloat) UnmarshalJSON(data []byte) error

type StringToTimeStampMs

type StringToTimeStampMs time.Time

func (StringToTimeStampMs) String

func (t StringToTimeStampMs) String() string

func (StringToTimeStampMs) Time

func (t StringToTimeStampMs) Time() time.Time

func (StringToTimeStampMs) UnixMilli

func (t StringToTimeStampMs) UnixMilli() int64

func (*StringToTimeStampMs) UnmarshalJSON

func (uoe *StringToTimeStampMs) UnmarshalJSON(data []byte) error

type StringToUint64

type StringToUint64 uint64

func (*StringToUint64) String

func (uoe *StringToUint64) String() string

func (*StringToUint64) UnmarshalJSON

func (uoe *StringToUint64) UnmarshalJSON(data []byte) error

type TimestampToTime

type TimestampToTime time.Time

func (*TimestampToTime) MarshalJSON

func (tf *TimestampToTime) MarshalJSON() ([]byte, error)

func (TimestampToTime) String

func (tf TimestampToTime) String() string

func (*TimestampToTime) UnmarshalJSON

func (tf *TimestampToTime) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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