market

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Market

type Market struct {
	Station station.StationMap // map of station IDs and stations
}

Market represents the whole station market

func NewMarket

func NewMarket() *Market

NewMarket returns an initialized *Market

func (*Market) AddPrice

func (m *Market) AddPrice(timestamp int64, ID, fuel string, price float64) error

AddPrice adds a fuel price for a station and the given Unix epoch timestamp

func (*Market) BestStations

func (m *Market) BestStations(timestamp int64, fuel string) (goodPrice float64, stations station.StationMap)

BestStations returns the best stations as a map with station ID as key

func (*Market) UpsertStation

func (m *Market) UpsertStation(ID, brand, name, place string)

UpsertStation upserts a station to the market

Jump to

Keyboard shortcuts

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