moving_average

package
v0.192.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayContainer

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

func NewArrayContainer

func NewArrayContainer(a array.Array) *ArrayContainer

func (*ArrayContainer) Array added in v0.40.0

func (a *ArrayContainer) Array() array.Array

func (*ArrayContainer) IsNull

func (a *ArrayContainer) IsNull(i int) bool

func (*ArrayContainer) IsValid

func (a *ArrayContainer) IsValid(i int) bool

func (*ArrayContainer) Len

func (a *ArrayContainer) Len() int

func (*ArrayContainer) OrigValue

func (a *ArrayContainer) OrigValue(i int) interface{}

func (*ArrayContainer) Release

func (a *ArrayContainer) Release()

func (*ArrayContainer) Slice

func (a *ArrayContainer) Slice(i int, j int) *ArrayContainer

func (*ArrayContainer) Value

func (a *ArrayContainer) Value(i int) values.Value

type ExponentialMovingAverage

type ExponentialMovingAverage struct {
	Multiplier float64
	// contains filtered or unexported fields
}

func New

func New(inTimePeriod int, numCols int) *ExponentialMovingAverage

func (*ExponentialMovingAverage) Add

Used when we need to do EMA step by step

func (*ExponentialMovingAverage) AddNull

func (r *ExponentialMovingAverage) AddNull(bj int)

Used when we need to do EMA step by step Skips over the null, increments cursor

func (*ExponentialMovingAverage) DoNumeric

func (r *ExponentialMovingAverage) DoNumeric(vs *ArrayContainer, b execute.TableBuilder, bj int, doExponentialMovingAverage bool, appendToTable bool) error

func (*ExponentialMovingAverage) Finish

func (r *ExponentialMovingAverage) Finish(cols []flux.ColMeta, builder execute.TableBuilder, valueIdx int) error

If we don't have enough values for a proper EMA, just append the last value (which is the average of the values so far)

func (*ExponentialMovingAverage) GetEMA

func (r *ExponentialMovingAverage) GetEMA(bj int) []interface{}

func (*ExponentialMovingAverage) LastVal

func (r *ExponentialMovingAverage) LastVal(bj int) interface{}

The last value encountered

func (*ExponentialMovingAverage) PassThrough

func (*ExponentialMovingAverage) PassThroughTime

func (r *ExponentialMovingAverage) PassThroughTime(vs *array.Int, b execute.TableBuilder, bj int) error

func (*ExponentialMovingAverage) Value

func (r *ExponentialMovingAverage) Value(bj int) float64

The current EMA value

Jump to

Keyboard shortcuts

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