signals

package
v0.0.0-...-dce33ef Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOGNONE = iota
	LOGINFO = iota
	LOGDBG  = iota
)
View Source
const (
	FP_TOLERANCE = 0.0000000000001
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bin

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

func NewBin

func NewBin(start, interval, offest float64) *Bin

func (*Bin) Add

func (p *Bin) Add(val float64)

func (*Bin) Count

func (p *Bin) Count() float64

func (*Bin) LastUpdate

func (p *Bin) LastUpdate() time.Duration

func (*Bin) MidValue

func (p *Bin) MidValue() float64

func (*Bin) TryAdd

func (p *Bin) TryAdd(val float64) bool

type SigCurve

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

func LoadFromStorage

func LoadFromStorage(storename string, fs store.Store, maxage time.Duration) (sigcurve *SigCurve, isvalid bool)

/Optionally, try to load data from a store - make sure the name is unique / potentially slightly wasteful in terms of memory - but it should get cleaned up

func NewSigCurve

func NewSigCurve(numsamples int, mindatapoints int, minslope float64, window int, minrsqrd float64) *SigCurve

* numsamples - number of samples to use to keep window - how many samples are used to calculat the slope mindatapoints - the minimum number of data points before we do anything - 1 datapoint = 1 window of samples minslope - what slope do you consider to be a upward/downward trend (and because it's time based, you'll need to experiment with real data) minrsqrd - what is the min R squared value to accept as reliable (start with about 0.45)

To load/store from stored data use Restore - this is intended to be used after a restart so that it doesn't have to rebuild all stats from nothing if there was a failure - it mainly is aimed at being able to do a simple restart on connection failure, where all the subscriptions etc can make it difficult to do a reconnect

func NewSigCurveWithFactor

func NewSigCurveWithFactor(numsamples int, mindatapoints int, minslope float64, window int, minrsqrd float64,
	shiftfactor float64) *SigCurve

func (*SigCurve) AddVarianceSample

func (p *SigCurve) AddVarianceSample(variance float64, t time.Time)

func (*SigCurve) Decode

func (p *SigCurve) Decode(buffer io.Reader)

func (*SigCurve) Encode

func (p *SigCurve) Encode(buffer io.Writer)

func (*SigCurve) GetStatsCounters

func (p *SigCurve) GetStatsCounters() []perfstats.Stat

func (*SigCurve) LogLevel

func (p *SigCurve) LogLevel(level int)

func (*SigCurve) Plot

func (p *SigCurve) Plot()

func (*SigCurve) SetupStorage

func (p *SigCurve) SetupStorage(storename string, fs store.Store, howoftentosave time.Duration)

// This just sets up the storage - it won't save it

func (*SigCurve) SigBuy

func (p *SigCurve) SigBuy() bool

func (*SigCurve) SigSell

func (p *SigCurve) SigSell() bool

type SigPercentile

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

func LoadFromStorageSigPC

func LoadFromStorageSigPC(storename string, fs store.Store, maxage time.Duration) (sigpc *SigPercentile, isvalid bool)

/Optionally, try to load data from a store - make sure the name is unique / potentially slightly wasteful in terms of memory - but it should get cleaned up

func NewSigPercentile

func NewSigPercentile(buybelow, sellabove float64, mindata int, targetage time.Duration) *SigPercentile

* targetage - the ideal age of data to calculate the percentile from - e.g. if you want to use ~1 days worth of data ideally, then set 1d

func (*SigPercentile) AddData

func (p *SigPercentile) AddData(val float64)

func (*SigPercentile) Decode

func (p *SigPercentile) Decode(buffer io.Reader)

func (*SigPercentile) Encode

func (p *SigPercentile) Encode(buffer io.Writer)

func (*SigPercentile) GetStatsCounters

func (p *SigPercentile) GetStatsCounters() []perfstats.Stat

func (*SigPercentile) Plot

func (p *SigPercentile) Plot()

func (*SigPercentile) SetRange

func (p *SigPercentile) SetRange(val float64)

func (*SigPercentile) SetupStorage

func (p *SigPercentile) SetupStorage(storename string, fs store.Store, howoftentosave time.Duration)

// This just sets up the storage - it won't save it

func (*SigPercentile) SigBuy

func (p *SigPercentile) SigBuy() bool

func (*SigPercentile) SigSell

func (p *SigPercentile) SigSell() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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