prices

package
v1.0.84 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format added in v1.0.70

func Format(price float64) string

Types

type Prices

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

Prices represents a collection of energy prices.

Though we understand there to be 24 prices (one for each hour of the day) in practice, Prices doesn't enforce this. Instead, it is up to the caller to ensure that the number of prices is correct. This might seem odd, but it makes Prices somewhat more flexible, and it makes testing easier.

func New

func New(prices []float64) *Prices

func (*Prices) All

func (p *Prices) All() iter.Seq2[int, float64]

func (*Prices) Average

func (p *Prices) Average() float64

func (*Prices) AverageHours

func (p *Prices) AverageHours() []int

func (*Prices) High

func (p *Prices) High() float64

func (*Prices) HighHours

func (p *Prices) HighHours() []int

func (*Prices) Low

func (p *Prices) Low() float64

func (*Prices) LowHours

func (p *Prices) LowHours() []int

Jump to

Keyboard shortcuts

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