tokens

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedPricer

type CachedPricer struct {
	// contains filtered or unexported fields
}

func NewCachedPricer

func NewCachedPricer(p Pricer) *CachedPricer

func (*CachedPricer) ClearCache

func (c *CachedPricer) ClearCache()

func (*CachedPricer) Price

func (c *CachedPricer) Price(ctx context.Context, tokens ...Token) (map[Token]float64, error)

type MockPricer

type MockPricer struct {
	// contains filtered or unexported fields
}

func NewMockPricer

func NewMockPricer(prices map[Token]float64) *MockPricer

func (*MockPricer) Price

func (m *MockPricer) Price(_ context.Context, tkns ...Token) (map[Token]float64, error)

func (*MockPricer) SetPrice

func (m *MockPricer) SetPrice(token Token, price float64)

type Pricer

type Pricer interface {
	// Price returns the price of each provided token in USD.
	Price(ctx context.Context, tokens ...Token) (map[Token]float64, error)
}

Pricer is the token price provider interface.

type Token

type Token string
const (
	OMNI Token = "OMNI"
	ETH  Token = "ETH"
)

func FromCoingeckoID

func FromCoingeckoID(id string) (Token, bool)

func MustFromCoingeckoID

func MustFromCoingeckoID(id string) Token

func (Token) CoingeckoID

func (t Token) CoingeckoID() string

func (Token) String

func (t Token) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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