Documentation ¶
Index ¶
- Constants
- type AsyncProvider
- type ErrPairNotFound
- type Provider
- func (g *Provider) Models(pairs ...provider.Pair) (map[provider.Pair]*provider.Model, error)
- func (g *Provider) Pairs() ([]provider.Pair, error)
- func (g *Provider) Price(pair provider.Pair) (*provider.Price, error)
- func (g *Provider) Prices(pairs ...provider.Pair) (map[provider.Pair]*provider.Price, error)
Constants ¶
View Source
const LoggerTag = "ASYNC_GOFER"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncProvider ¶
type AsyncProvider struct { *Provider // contains filtered or unexported fields }
AsyncProvider implements the provider.Provider interface. It works just like Graph but allows updating prices asynchronously.
func NewAsyncProvider ¶
func NewAsyncProvider( graph map[provider.Pair]nodes.Aggregator, feeder *feeder.Feeder, nodes []nodes.Node, logger log.Logger, ) (*AsyncProvider, error)
NewAsyncProvider returns a new AsyncGofer instance.
func (*AsyncProvider) Start ¶
func (a *AsyncProvider) Start(ctx context.Context) error
Start starts asynchronous price updater.
func (*AsyncProvider) Wait ¶
func (a *AsyncProvider) Wait() <-chan error
Wait waits until the context is canceled or until an error occurs.
type ErrPairNotFound ¶
func (ErrPairNotFound) Error ¶
func (e ErrPairNotFound) Error() string
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the provider.Provider interface. It uses a graph structure to calculate pairs prices.
func NewProvider ¶
NewProvider returns a new Provider instance. If the GetByFeeder is not nil, then prices are automatically updated when the Price or Prices methods are called. Otherwise, prices have to be updated externally.
Click to show internal directories.
Click to hide internal directories.