oracle

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// SymbolETH refers to the ethereum symbol.
	SymbolETH = "ETH"
)

Variables

This section is empty.

Functions

func GetComputedPrices added in v1.4.0

func GetComputedPrices(
	logger zerolog.Logger,
	providerCandles pfprovider.AggregatedProviderCandles,
	providerPrices pfprovider.AggregatedProviderPrices,
	providerPairs map[pfprovider.Name][]pftypes.CurrencyPair,
	deviations map[string]sdk.Dec,
) (prices map[string]sdk.Dec, err error)

GetComputedPrices gets the candle and ticker prices and computes it. It returns candles' TVWAP if possible, if not possible (not available or due to some staleness) it will use the most recent ticker prices and the VWAP formula instead.

func GetStablecoinsCurrencyPair

func GetStablecoinsCurrencyPair(baseSymbol string) []umeepftypes.CurrencyPair

GetStablecoinsCurrencyPair return the currency pair of that symbol quoted by some stablecoins.

Types

type Oracle

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

Oracle implements the core component responsible for fetching exchange rates for a given set of currency pairs and determining the correct exchange rates.

func New

func New(ctx context.Context, logger zerolog.Logger, providersName []pfprovider.Name) (*Oracle, error)

func (*Oracle) GetPrice

func (o *Oracle) GetPrice(baseSymbol string) (sdk.Dec, error)

GetPrice returns the price based on the symbol ex.: UMEE, ETH.

func (*Oracle) GetPrices

func (o *Oracle) GetPrices(baseSymbols ...string) (map[string]sdk.Dec, error)

GetPrices returns the price for the provided base symbols.

func (*Oracle) Stop

func (o *Oracle) Stop()

Stop stops the oracle process and waits for it to gracefully exit.

func (*Oracle) SubscribeSymbols

func (o *Oracle) SubscribeSymbols(baseSymbols ...string) error

SubscribeSymbols attempts to subscribe the symbols in all the providers. baseSymbols is the base to be subscribed ex.: ["UMEE", "ATOM"].

type Provider

type Provider struct {
	pfprovider.Provider
	// contains filtered or unexported fields
}

Provider wraps the umee provider interface.

Jump to

Keyboard shortcuts

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