graph

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncGofer

type AsyncGofer struct {
	*Gofer
	// contains filtered or unexported fields
}

AsyncGofer implements the gofer.Gofer interface. It works just like Graph but allows to update prices asynchronously.

func NewAsyncGofer

func NewAsyncGofer(ctx context.Context, g map[gofer.Pair]nodes.Aggregator, f *feeder.Feeder) (*AsyncGofer, error)

NewAsyncGofer returns a new AsyncGofer instance.

func (*AsyncGofer) Start

func (a *AsyncGofer) Start() error

Start starts asynchronous price updater.

func (*AsyncGofer) Wait

func (a *AsyncGofer) Wait() chan error

Wait waits until the context is canceled or until an error occurs.

type ErrPairNotFound

type ErrPairNotFound struct {
	Pair gofer.Pair
}

func (ErrPairNotFound) Error

func (e ErrPairNotFound) Error() string

type Gofer

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

Gofer implements the gofer.Gofer interface. It uses a graph structure to calculate pairs prices.

func NewGofer

func NewGofer(g map[gofer.Pair]nodes.Aggregator, f *feeder.Feeder) *Gofer

NewGofer returns a new Gofer instance. If the Feeder is not nil, then prices are automatically updated when the Price or Prices methods are called. Otherwise prices have to be updated externally.

func (*Gofer) Models

func (g *Gofer) Models(pairs ...gofer.Pair) (map[gofer.Pair]*gofer.Model, error)

Models implements the gofer.Gofer interface.

func (*Gofer) Pairs

func (g *Gofer) Pairs() ([]gofer.Pair, error)

Pairs implements the gofer.Gofer interface.

func (*Gofer) Price

func (g *Gofer) Price(pair gofer.Pair) (*gofer.Price, error)

Price implements the gofer.Gofer interface.

func (*Gofer) Prices

func (g *Gofer) Prices(pairs ...gofer.Pair) (map[gofer.Pair]*gofer.Price, error)

Prices implements the gofer.Gofer interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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