Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAggregatePriceProvider ¶
func NewAggregatePriceProvider( sourcesToPairSymbolMap map[string]map[asset.Pair]types.Symbol, sourceConfigMap map[string]json.RawMessage, logger zerolog.Logger, ) types.PriceProvider
NewAggregatePriceProvider instantiates a new AggregatePriceProvider instance given multiple PriceProvider.
func NewPriceProvider ¶
func NewPriceProvider( sourceName string, pairToSymbolMap map[asset.Pair]types.Symbol, config json.RawMessage, logger zerolog.Logger, ) types.PriceProvider
NewPriceProvider returns a types.PriceProvider given the price source we want to gather prices from, the mapping between nibiru asset.Pair and the source's symbols, and a zerolog.Logger instance.
Types ¶
type AggregatePriceProvider ¶
type AggregatePriceProvider struct {
// contains filtered or unexported fields
}
AggregatePriceProvider aggregates multiple price providers and queries them for prices.
func (AggregatePriceProvider) Close ¶
func (a AggregatePriceProvider) Close()
func (AggregatePriceProvider) GetPrice ¶
func (a AggregatePriceProvider) GetPrice(pair asset.Pair) types.Price
GetPrice fetches the first available and correct price from the wrapped PriceProviders. Iteration is exhaustive and random. If no correct PriceResponse is found, then an invalid PriceResponse is returned.
type PriceProvider ¶
type PriceProvider struct {
// contains filtered or unexported fields
}
PriceProvider implements the types.PriceProvider interface. it wraps a Source and handles conversions between nibiru asset pair to exchange symbols.
func (*PriceProvider) Close ¶
func (p *PriceProvider) Close()