Documentation ¶
Index ¶
- Constants
- type Bin
- type SigCurve
- func LoadFromStorage(storename string, fs store.Store, maxage time.Duration) (sigcurve *SigCurve, isvalid bool)
- func NewSigCurve(numsamples int, mindatapoints int, minslope float64, window int, ...) *SigCurve
- func NewSigCurveWithFactor(numsamples int, mindatapoints int, minslope float64, window int, ...) *SigCurve
- func (p *SigCurve) AddVarianceSample(variance float64, t time.Time)
- func (p *SigCurve) Decode(buffer io.Reader)
- func (p *SigCurve) Encode(buffer io.Writer)
- func (p *SigCurve) GetStatsCounters() []perfstats.Stat
- func (p *SigCurve) LogLevel(level int)
- func (p *SigCurve) Plot()
- func (p *SigCurve) SetupStorage(storename string, fs store.Store, howoftentosave time.Duration)
- func (p *SigCurve) SigBuy() bool
- func (p *SigCurve) SigSell() bool
- type SigPercentile
- func (p *SigPercentile) AddData(val float64)
- func (p *SigPercentile) Decode(buffer io.Reader)
- func (p *SigPercentile) Encode(buffer io.Writer)
- func (p *SigPercentile) GetStatsCounters() []perfstats.Stat
- func (p *SigPercentile) Plot()
- func (p *SigPercentile) SetRange(val float64)
- func (p *SigPercentile) SetupStorage(storename string, fs store.Store, howoftentosave time.Duration)
- func (p *SigPercentile) SigBuy() bool
- func (p *SigPercentile) SigSell() bool
Constants ¶
const ( LOGNONE = iota LOGINFO = iota LOGDBG = iota )
const (
FP_TOLERANCE = 0.0000000000001
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 (*SigCurve) AddVarianceSample ¶
func (*SigCurve) GetStatsCounters ¶
func (*SigCurve) SetupStorage ¶
// This just sets up the storage - it won't save it
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