floats

package
v1.59.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: AGPL-3.0 Imports: 3 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Average

func Average(arr []float64) float64

func CrossOver

func CrossOver(series1 []float64, series2 []float64) bool

CrossOver returns true if series1 is crossing over series2.

NOTE: Usually this is used with Media Average Series to check if it crosses for buy signals.
      It assumes first values are the most recent.
      The crossover function does not use most recent value, since usually it's not a complete candle.
      The second recent values and the previous are used, instead.

ported from https://github.com/markcheno/go-talib/blob/master/talib.go

func CrossUnder

func CrossUnder(series1 []float64, series2 []float64) bool

CrossUnder returns true if series1 is crossing under series2.

NOTE: Usually this is used with Media Average Series to check if it crosses for sell signals.

ported from https://github.com/markcheno/go-talib/blob/master/talib.go

func FindPivot added in v1.48.0

func FindPivot(values Slice, left, right int, f func(a, pivot float64) bool) (float64, bool)

func Group

func Group(arr []float64, minDistance float64) []float64

func Higher

func Higher(arr []float64, x float64) []float64

func LSM added in v1.48.0

func LSM(values Slice) float64

LSM is the least squares method for linear regression

func Lower

func Lower(arr []float64, x float64) []float64

func MinMax

func MinMax(inReal []float64, inTimePeriod int) (outMin []float64, outMax []float64)

MinMax - Lowest and highest values over a specified period ported from https://github.com/markcheno/go-talib/blob/master/talib.go

func Multiply

func Multiply(inReal0 []float64, inReal1 []float64) []float64

Multiply multiplies two float series

Types

type Map

type Map map[string]float64

func (Map) DivScalar

func (m Map) DivScalar(x float64) Map

func (Map) MulScalar

func (m Map) MulScalar(x float64) Map

func (Map) Normalize

func (m Map) Normalize() Map

func (Map) Sum

func (m Map) Sum() float64

type Slice

type Slice []float64

func New

func New(a ...float64) Slice

func (Slice) Abs

func (s Slice) Abs() (values Slice)

func (Slice) Add added in v1.48.0

func (s Slice) Add(b Slice) (c Slice)

func (Slice) Addr

func (s Slice) Addr() *Slice

func (*Slice) Append added in v1.48.0

func (s *Slice) Append(vs ...float64)

func (Slice) Average added in v1.48.0

func (s Slice) Average() float64

func (Slice) Diff

func (s Slice) Diff() (values Slice)

func (Slice) DivScalar

func (s Slice) DivScalar(x float64) (values Slice)

func (Slice) Dot

func (s Slice) Dot(other Slice) float64

func (Slice) Index

func (s Slice) Index(i int) float64

Index fetches the element from the end of the slice WARNING: it does not start from 0!!!

func (Slice) LSM added in v1.48.0

func (s Slice) LSM() float64

func (Slice) Last

func (s Slice) Last(i int) float64

Last, Index, Length implements the types.Series interface

func (Slice) Length

func (s Slice) Length() int

func (Slice) Max

func (s Slice) Max() float64

func (Slice) Mean

func (s Slice) Mean() (mean float64)

func (Slice) Min

func (s Slice) Min() float64

func (Slice) Mul

func (s Slice) Mul(other Slice) (values Slice)

func (Slice) MulScalar

func (s Slice) MulScalar(x float64) (values Slice)

func (Slice) NegativeValuesOrZero

func (s Slice) NegativeValuesOrZero() (values Slice)

func (Slice) Normalize

func (s Slice) Normalize() Slice

func (Slice) Pivot added in v1.41.0

func (s Slice) Pivot(left, right int, f func(a, pivot float64) bool) (float64, bool)

func (*Slice) Pop

func (s *Slice) Pop(i int64) (v float64)

func (Slice) PositiveValuesOrZero

func (s Slice) PositiveValuesOrZero() (values Slice)

func (*Slice) Push

func (s *Slice) Push(v float64)

func (Slice) Sub added in v1.48.0

func (s Slice) Sub(b Slice) (c Slice)

func (Slice) Sum

func (s Slice) Sum() (sum float64)

func (Slice) Tail

func (s Slice) Tail(size int) Slice

func (Slice) Truncate added in v1.48.0

func (s Slice) Truncate(size int) Slice

func (*Slice) Update

func (s *Slice) Update(v float64)

Update equals to Push() which push an element into the slice

Jump to

Keyboard shortcuts

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