gota

package
v0.0.0-...-2f6135f Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2020 License: MIT Imports: 2 Imported by: 0

README

This is a port of gota to be adapted inside of InfluxDB.

This port was made with the permission of the author, Patrick Hemmer, and has been modified to remove dependencies that are not part of InfluxDB.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlgSimple

type AlgSimple interface {
	Add(float64) float64
	Warmed() bool
	WarmCount() int
}

type CMO

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

CMO - Chande Momentum Oscillator (https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/cmo)

func NewCMO

func NewCMO(inTimePeriod int) *CMO

NewCMO constructs a new CMO.

func (*CMO) Add

func (cmo *CMO) Add(v float64) float64

Add adds a new sample value to the algorithm and returns the computed value.

func (*CMO) WarmCount

func (cmo *CMO) WarmCount() int

WarmCount returns the number of samples that must be provided for the algorithm to be fully "warmed".

func (*CMO) Warmed

func (cmo *CMO) Warmed() bool

Warmed indicates whether the algorithm has enough data to generate accurate results.

type CMOS

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

CMOS is a smoothed version of the Chande Momentum Oscillator. This is the version of CMO utilized by ta-lib.

func NewCMOS

func NewCMOS(inTimePeriod int, warmType WarmupType) *CMOS

NewCMOS constructs a new CMOS.

func (*CMOS) Add

func (cmos *CMOS) Add(v float64) float64

Add adds a new sample value to the algorithm and returns the computed value.

func (CMOS) Last

func (cmos CMOS) Last() float64

Last returns the last output value.

func (CMOS) WarmCount

func (cmos CMOS) WarmCount() int

WarmCount returns the number of samples that must be provided for the algorithm to be fully "warmed".

func (CMOS) Warmed

func (cmos CMOS) Warmed() bool

Warmed indicates whether the algorithm has enough data to generate accurate results.

type DEMA

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

DEMA - Double Exponential Moving Average (https://en.wikipedia.org/wiki/Double_exponential_moving_average)

func NewDEMA

func NewDEMA(inTimePeriod int, warmType WarmupType) *DEMA

NewDEMA constructs a new DEMA.

When warmed with WarmSMA the first inTimePeriod samples will result in a simple average, switching to exponential moving average after warmup is complete.

When warmed with WarmEMA the algorithm immediately starts using an exponential moving average for the output values. During the warmup period the alpha value is scaled to prevent unbalanced weighting on initial values.

func (*DEMA) Add

func (dema *DEMA) Add(v float64) float64

Add adds a new sample value to the algorithm and returns the computed value.

func (*DEMA) WarmCount

func (dema *DEMA) WarmCount() int

WarmCount returns the number of samples that must be provided for the algorithm to be fully "warmed".

func (*DEMA) Warmed

func (dema *DEMA) Warmed() bool

Warmed indicates whether the algorithm has enough data to generate accurate results.

type EMA

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

EMA - Exponential Moving Average (http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages#exponential_moving_average_calculation)

func NewEMA

func NewEMA(inTimePeriod int, warmType WarmupType) *EMA

NewEMA constructs a new EMA.

When warmed with WarmSMA the first inTimePeriod samples will result in a simple average, switching to exponential moving average after warmup is complete.

When warmed with WarmEMA the algorithm immediately starts using an exponential moving average for the output values. During the warmup period the alpha value is scaled to prevent unbalanced weighting on initial values.

func (*EMA) Add

func (ema *EMA) Add(v float64) float64

Add adds a new sample value to the algorithm and returns the computed value.

func (*EMA) Last

func (ema *EMA) Last() float64

Last returns the last output value.

func (*EMA) WarmCount

func (ema *EMA) WarmCount() int

WarmCount returns the number of samples that must be provided for the algorithm to be fully "warmed".

func (*EMA) Warmed

func (ema *EMA) Warmed() bool

Warmed indicates whether the algorithm has enough data to generate accurate results.

type KAMA

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

KAMA - Kaufman's Adaptive Moving Average (http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:kaufman_s_adaptive_moving_average)

func NewKAMA

func NewKAMA(inTimePeriod int) *KAMA

NewKAMA constructs a new KAMA.

func (*KAMA) Add

func (kama *KAMA) Add(v float64) float64

Add adds a new sample value to the algorithm and returns the computed value.

func (*KAMA) WarmCount

func (kama *KAMA) WarmCount() int

WarmCount returns the number of samples that must be provided for the algorithm to be fully "warmed".

func (*KAMA) Warmed

func (kama *KAMA) Warmed() bool

Warmed indicates whether the algorithm has enough data to generate accurate results.

type KER

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

KER - Kaufman's Efficiency Ratio (http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:kaufman_s_adaptive_moving_average#efficiency_ratio_er)

func NewKER

func NewKER(inTimePeriod int) *KER

NewKER constructs a new KER.

func (*KER) Add

func (ker *KER) Add(v float64) float64

Add adds a new sample value to the algorithm and returns the computed value.

func (*KER) WarmCount

func (ker *KER) WarmCount() int

WarmCount returns the number of samples that must be provided for the algorithm to be fully "warmed".

func (*KER) Warmed

func (ker *KER) Warmed() bool

Warmed indicates whether the algorithm has enough data to generate accurate results.

type RSI

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

RSI - Relative Strength Index (http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:relative_strength_index_rsi)

func NewRSI

func NewRSI(inTimePeriod int, warmType WarmupType) *RSI

NewRSI constructs a new RSI.

func (*RSI) Add

func (rsi *RSI) Add(v float64) float64

Add adds a new sample value to the algorithm and returns the computed value.

func (RSI) Last

func (rsi RSI) Last() float64

Last returns the last output value.

func (RSI) WarmCount

func (rsi RSI) WarmCount() int

WarmCount returns the number of samples that must be provided for the algorithm to be fully "warmed".

func (RSI) Warmed

func (rsi RSI) Warmed() bool

Warmed indicates whether the algorithm has enough data to generate accurate results.

type TEMA

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

TEMA - Triple Exponential Moving Average (https://en.wikipedia.org/wiki/Triple_exponential_moving_average)

func NewTEMA

func NewTEMA(inTimePeriod int, warmType WarmupType) *TEMA

NewTEMA constructs a new TEMA.

When warmed with WarmSMA the first inTimePeriod samples will result in a simple average, switching to exponential moving average after warmup is complete.

When warmed with WarmEMA the algorithm immediately starts using an exponential moving average for the output values. During the warmup period the alpha value is scaled to prevent unbalanced weighting on initial values.

func (*TEMA) Add

func (tema *TEMA) Add(v float64) float64

Add adds a new sample value to the algorithm and returns the computed value.

func (*TEMA) WarmCount

func (tema *TEMA) WarmCount() int

WarmCount returns the number of samples that must be provided for the algorithm to be fully "warmed".

func (*TEMA) Warmed

func (tema *TEMA) Warmed() bool

Warmed indicates whether the algorithm has enough data to generate accurate results.

type TRIX

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

Trix - TRIple Exponential average (http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:trix)

func NewTRIX

func NewTRIX(inTimePeriod int, warmType WarmupType) *TRIX

NewTRIX constructs a new TRIX.

func (*TRIX) Add

func (trix *TRIX) Add(v float64) float64

Add adds a new sample value to the algorithm and returns the computed value.

func (*TRIX) WarmCount

func (trix *TRIX) WarmCount() int

WarmCount returns the number of samples that must be provided for the algorithm to be fully "warmed".

func (*TRIX) Warmed

func (trix *TRIX) Warmed() bool

Warmed indicates whether the algorithm has enough data to generate accurate results.

type WarmupType

type WarmupType int8
const (
	WarmEMA WarmupType = iota // Exponential Moving Average
	WarmSMA                   // Simple Moving Average
)

func ParseWarmupType

func ParseWarmupType(wt string) (WarmupType, error)

Jump to

Keyboard shortcuts

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