sma

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrGeneric is a generic error happening for any error on SMA package.
	ErrGeneric = errors.New("error with SMA")
)

Functions

func InvalidValues

func InvalidValues(ts *timeserie.TimeSerie[float64]) bool

InvalidValues returns true if there is at least one invalid value in the timeserie.

func TimeSerie

func TimeSerie(params TimeSerieParams) (*timeserie.TimeSerie[float64], error)

TimeSerie returns a timeserie of calculated points.

Types

type Point

type Point struct {
	Exchange  string
	Pair      string
	Period    period.Symbol
	PeriodNb  int
	PriceType candlestick.PriceType
	Time      time.Time
	Price     float64
}

Point is a point of the SMA.

func NewPoint

func NewPoint(params PointParameters) Point

NewPoint creates a new point from the given parameters.

type PointParameters

type PointParameters struct {
	Candlesticks *candlestick.List
	PriceType    candlestick.PriceType
}

PointParameters is the params for the Point function.

type TimeSerieParams

type TimeSerieParams struct {
	Candlesticks *candlestick.List
	PriceType    candlestick.PriceType
	Start        time.Time
	End          time.Time
	PeriodNumber int
}

TimeSerieParams is the parameters needed to create a timeserie.

Jump to

Keyboard shortcuts

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