filters

package
v1.4.505 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveOutliers added in v1.4.2

func RemoveOutliers(samples []float64, scale float64) ([]float64, []int)

Types

type Filter

type Filter interface {
	// contains filtered or unexported methods
}

Filter interface defines a filter's methods processing trades from the tradesBlockService.

type FilterCOUNT added in v1.4.44

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

func NewFilterCOUNT added in v1.4.44

func NewFilterCOUNT(asset dia.Asset, exchange string, memory int) *FilterCOUNT

func (*FilterCOUNT) Compute added in v1.4.44

func (filter *FilterCOUNT) Compute(trade dia.Trade)

func (*FilterCOUNT) FilterPointForBlock added in v1.4.44

func (filter *FilterCOUNT) FilterPointForBlock() *dia.FilterPoint

func (*FilterCOUNT) FinalCompute added in v1.4.44

func (filter *FilterCOUNT) FinalCompute(t time.Time)

type FilterEMA added in v1.4.0

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

FilterEMA is the struct for a moving average filter implementing the Filter interface.

func NewFilterEMA added in v1.4.0

func NewFilterEMA(asset dia.Asset, exchange string, currentTime time.Time, blockSize int) *FilterEMA

NewFilterEMA returns a moving average filter.

func (*FilterEMA) Compute added in v1.4.0

func (s *FilterEMA) Compute(trade dia.FilterPoint)

func (*FilterEMA) FilterPointForBlock added in v1.4.0

func (e *FilterEMA) FilterPointForBlock() *dia.FilterPoint

func (*FilterEMA) FinalCompute added in v1.4.0

func (s *FilterEMA) FinalCompute(t time.Time) float64

type FilterMA

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

FilterMA is the struct for a moving average filter implementing the Filter interface.

func NewFilterMA

func NewFilterMA(asset dia.Asset, exchange string, currentTime time.Time, memory int, nativeDenomination bool) *FilterMA

NewFilterMA returns a moving average filter. @currentTime is the begin time of the filtersBlock.

func (*FilterMA) Compute added in v1.2.0

func (filter *FilterMA) Compute(trade dia.Trade)

func (*FilterMA) FilterPointForBlock added in v1.2.0

func (filter *FilterMA) FilterPointForBlock() *dia.FilterPoint

func (*FilterMA) FinalCompute added in v1.2.0

func (filter *FilterMA) FinalCompute(t time.Time) float64

type FilterMAIR

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

FilterMAIR implements a trimmed moving average. Outliers are eliminated using interquartile range. see: https://en.wikipedia.org/wiki/Interquartile_range

func NewFilterMAIR

func NewFilterMAIR(asset dia.Asset, exchange string, currentTime time.Time, memory int, nativeDenomination bool) *FilterMAIR

NewFilterMAIR returns a FilterMAIR

func (*FilterMAIR) Compute added in v1.2.0

func (filter *FilterMAIR) Compute(trade dia.Trade)

func (*FilterMAIR) FilterPointForBlock added in v1.2.0

func (filter *FilterMAIR) FilterPointForBlock() *dia.FilterPoint

func (*FilterMAIR) FinalCompute added in v1.2.0

func (filter *FilterMAIR) FinalCompute(t time.Time) float64

type FilterMEDIR

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

FilterMEDIR contains the configuration parameters of the filter. It implements a trimmed median. Outliers are eliminated using interquartile range see: https://en.wikipedia.org/wiki/Interquartile_range

func NewFilterMEDIR

func NewFilterMEDIR(asset dia.Asset, exchange string, currentTime time.Time, memory int, nativeDenomination bool) *FilterMEDIR

NewFilterMEDIR creates a FilterMEDIR

func (*FilterMEDIR) Compute added in v1.4.0

func (filter *FilterMEDIR) Compute(trade dia.Trade)

func (*FilterMEDIR) FilterPointForBlock added in v1.4.0

func (filter *FilterMEDIR) FilterPointForBlock() *dia.FilterPoint

func (*FilterMEDIR) FinalCompute added in v1.4.0

func (filter *FilterMEDIR) FinalCompute(t time.Time)

type FilterTLT

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

func NewFilterTLT

func NewFilterTLT(asset dia.Asset, exchange string) *FilterTLT

type FilterVOL

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

func NewFilterVOL

func NewFilterVOL(asset dia.Asset, exchange string, memory int) *FilterVOL

func (*FilterVOL) Compute added in v1.4.2

func (filter *FilterVOL) Compute(trade dia.Trade)

func (*FilterVOL) FilterPointForBlock added in v1.4.2

func (filter *FilterVOL) FilterPointForBlock() *dia.FilterPoint

func (*FilterVOL) FinalCompute added in v1.4.2

func (filter *FilterVOL) FinalCompute(t time.Time)

type FilterVWAP added in v1.2.0

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

FilterVWAP ...

func NewFilterVWAP added in v1.2.0

func NewFilterVWAP(asset dia.Asset, exchange string, currentTime time.Time, param int, nativeDenomination bool) *FilterVWAP

NewFilterVWAP ...

func (*FilterVWAP) Compute added in v1.2.0

func (s *FilterVWAP) Compute(trade dia.Trade)

Compute ...

func (*FilterVWAP) FilterPointForBlock added in v1.2.0

func (s *FilterVWAP) FilterPointForBlock() *dia.FilterPoint

FilterPointForBlock ...

func (*FilterVWAP) FinalCompute added in v1.2.0

func (s *FilterVWAP) FinalCompute(t time.Time) float64

FinalCompute ...

type FilterVWAPIR added in v1.2.0

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

FilterVWAP ...

func NewFilterVWAPIR added in v1.2.0

func NewFilterVWAPIR(asset dia.Asset, exchange string, currentTime time.Time, param int, nativeDenomination bool) *FilterVWAPIR

func (*FilterVWAPIR) Compute added in v1.2.0

func (s *FilterVWAPIR) Compute(trade dia.Trade)

func (*FilterVWAPIR) FilterPointForBlock added in v1.2.0

func (s *FilterVWAPIR) FilterPointForBlock() *dia.FilterPoint

func (*FilterVWAPIR) FinalCompute added in v1.2.0

func (s *FilterVWAPIR) FinalCompute(t time.Time) float64

type FiltersBlockService

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

FiltersBlockService is the data structure containing all objects necessary for the processing of a tradesBlock.

func NewFiltersBlockService

func NewFiltersBlockService(previousBlockFilters []dia.FilterPoint, datastore models.Datastore, chanFiltersBlock chan *dia.FiltersBlock) *FiltersBlockService

NewFiltersBlockService returns a new FiltersBlockService and runs mainLoop() in a go routine.

func (*FiltersBlockService) Close

func (s *FiltersBlockService) Close() error

Close gracefully closes the Filtersblockservice

func (*FiltersBlockService) ProcessTradesBlock

func (s *FiltersBlockService) ProcessTradesBlock(tradesBlock *dia.TradesBlock)

ProcessTradesBlock sends a filled tradesBlock into the filtersBlock channel.

Jump to

Keyboard shortcuts

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