graph

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

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.Node,
	feeder *feeder.Feeder,
	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

type ErrPairNotFound struct {
	Pair provider.Pair
}

func (ErrPairNotFound) Error

func (e ErrPairNotFound) Error() string

type Graphs added in v0.10.0

type Graphs map[provider.Pair]nodes.Node

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

func NewProvider(graph Graphs, feeder *feeder.Feeder) *Provider

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.

func (*Provider) Models

func (g *Provider) Models(pairs ...provider.Pair) (map[provider.Pair]*provider.Model, error)

Models implements the provider.Provider interface.

func (*Provider) Pairs

func (g *Provider) Pairs() ([]provider.Pair, error)

Pairs implements the provider.Provider interface.

func (*Provider) Price

func (g *Provider) Price(pair provider.Pair) (*provider.Price, error)

Price implements the provider.Provider interface.

func (*Provider) Prices

func (g *Provider) Prices(pairs ...provider.Pair) (map[provider.Pair]*provider.Price, error)

Prices implements the provider.Providerinterface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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