types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const BTC = "btc"
View Source
const KRW = "krw"
View Source
const LUNA = "luna"
View Source
const SDR = "sdr"
View Source
const USD = "usd"

Variables

This section is empty.

Functions

func PairStr

func PairStr(base string, quote string) string

Types

type BasePair

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

func NewPair

func NewPair(base string, quote string) BasePair

func (BasePair) Base

func (pair BasePair) Base() string

func (BasePair) Price

func (pair BasePair) Price() (sdk.Dec, error)

func (BasePair) Quote

func (pair BasePair) Quote() string

func (BasePair) SetPrice

func (pair BasePair) SetPrice(price sdk.Dec) Pair

func (BasePair) String

func (pair BasePair) String() string

type Pair

type Pair interface {
	String() string
	Base() string
	Quote() string

	Price() (sdk.Dec, error)
	SetPrice(sdk.Dec) Pair
}

Pair indicates how many {Quote} currency are needed to purchase one {Base} currency. And, pair should be immutable. So, if you want to set value in pair, you should return new structure.

type Source

type Source interface {
	Market() string
	Pair() Pair
	Fetch() error
	Interval() time.Duration
}

Source fetches pair and sets price from market every {interval}.

type SourceProvider

type SourceProvider func(interval time.Duration) Source

Jump to

Keyboard shortcuts

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