pricing

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	AddSource(sourcecfg config.SourceConfig) error
	GetSource(name string) (config.SourceConfig, error)
	GetSources() ([]config.SourceConfig, error)

	PriceList(source string) config.PriceList
	GetPrice(pricecfg config.PriceConfig) (PriceInfo, error)
	GetPrices() map[config.PriceConfig]PriceInfo
	UpdatePrice(pricecfg config.PriceConfig, newPrice PriceInfo)

	StartFetching() error
}

Engine is the source of price information from multiple external/internal/fake sources.

func NewEngine

func NewEngine(prices config.PriceList) Engine

NewEngine creates a new pricing engine.

type PriceInfo

type PriceInfo struct {
	Price             float64
	LastUpdatedReal   time.Time
	LastUpdatedWander time.Time
}

PriceInfo describes a price from a source. The price may be a real updated from an upstream source, or one that has been wandered. The LastUpdated timstamps indicate when the price was last fetched for real and when (if at all) it was last wandered.

func (PriceInfo) String

func (pi PriceInfo) String() string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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