indicators

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SeriesName = "indicator"
)

Functions

func Momentum12631 added in v0.5.0

func Momentum12631(prices *dataframe.DataFrame) *dataframe.DataFrame

Momentum12631 computes the equal weighted average momentum score over 1-, 3-, 6-, and 12-month periods

func Momentum631 added in v0.5.0

func Momentum631(prices *dataframe.DataFrame, riskFreeRate *dataframe.DataFrame) *dataframe.DataFrame

Momentum631 computes the 6-3-1 momentum of each column in df momentum(period) = (df / lag(df, period) - 1) * 100 - riskFreeRate

Types

type Indicator

type Indicator interface {
	IndicatorForPeriod(ctx context.Context, start time.Time, end time.Time) (*dataframe.DataFrame, error)
}

type Momentum

type Momentum struct {
	Securities []*data.Security
	Periods    []int
}

Momentum calculates the average momentum for each security listed in `Securities` for each lookback period in `Periods` and calculates an indicator based on the max momentum of all securities

func (*Momentum) IndicatorForPeriod

func (m *Momentum) IndicatorForPeriod(_ context.Context, start time.Time, end time.Time) (*dataframe.DataFrame, error)

Jump to

Keyboard shortcuts

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