indicator

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 6 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateKLinesEMA added in v1.3.1

func CalculateKLinesEMA(allKLines []types.KLine, priceF KLinePriceMapper, window int) float64

func KLineClosePriceMapper added in v1.2.1

func KLineClosePriceMapper(k types.KLine) float64

func KLineOpenPriceMapper added in v1.2.1

func KLineOpenPriceMapper(k types.KLine) float64

func MapKLinePrice added in v1.2.1

func MapKLinePrice(kLines []types.KLine, f KLinePriceMapper) (prices []float64)

Types

type BOLL

type BOLL struct {
	types.IntervalWindow

	// times of Std, generally it's 2
	K float64

	SMA      Float64Slice
	StdDev   Float64Slice
	UpBand   Float64Slice
	DownBand Float64Slice

	EndTime time.Time
	// contains filtered or unexported fields
}

func (*BOLL) Bind

func (inc *BOLL) Bind(updater KLineWindowUpdater)

func (*BOLL) EmitUpdate

func (inc *BOLL) EmitUpdate(sma float64, upBand float64, downBand float64)

func (*BOLL) LastDownBand

func (inc *BOLL) LastDownBand() float64

func (*BOLL) LastSMA

func (inc *BOLL) LastSMA() float64

func (*BOLL) LastStdDev

func (inc *BOLL) LastStdDev() float64

func (*BOLL) LastUpBand

func (inc *BOLL) LastUpBand() float64

func (*BOLL) OnUpdate

func (inc *BOLL) OnUpdate(cb func(sma float64, upBand float64, downBand float64))

type EWMA

type EWMA struct {
	types.IntervalWindow
	Values       Float64Slice
	LastOpenTime time.Time

	UpdateCallbacks []func(value float64)
}

func (*EWMA) Bind

func (inc *EWMA) Bind(updater KLineWindowUpdater)

func (*EWMA) EmitUpdate added in v1.2.1

func (inc *EWMA) EmitUpdate(value float64)

func (*EWMA) Last

func (inc *EWMA) Last() float64

func (*EWMA) OnUpdate added in v1.2.1

func (inc *EWMA) OnUpdate(cb func(value float64))

type Float64Slice

type Float64Slice []float64

func (*Float64Slice) Push

func (s *Float64Slice) Push(v float64)

type KLinePriceMapper added in v1.2.1

type KLinePriceMapper func(k types.KLine) float64

type KLineWindowUpdater

type KLineWindowUpdater interface {
	OnKLineWindowUpdate(func(interval types.Interval, window types.KLineWindow))
}

type SMA

type SMA struct {
	types.IntervalWindow
	Values  Float64Slice
	EndTime time.Time

	UpdateCallbacks []func(value float64)
}

func (*SMA) Bind

func (inc *SMA) Bind(updater KLineWindowUpdater)

func (*SMA) EmitUpdate added in v1.2.1

func (inc *SMA) EmitUpdate(value float64)

func (*SMA) Last

func (inc *SMA) Last() float64

func (*SMA) OnUpdate added in v1.2.1

func (inc *SMA) OnUpdate(cb func(value float64))

Jump to

Keyboard shortcuts

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