Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Filter ¶
type Filter interface {
// contains filtered or unexported methods
}
Filter interface defines a filter's methods processing trades from the tradesBlockService.
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
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 ¶
NewFilterMA returns a moving average filter. @currentTime is the begin time of the filtersBlock.
func (*FilterMA) FilterPointForBlock ¶ added in v1.2.0
func (filter *FilterMA) FilterPointForBlock() *dia.FilterPoint
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 ¶
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) *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 FilterVOL ¶
type FilterVOL struct {
// contains filtered or unexported fields
}
func (*FilterVOL) FilterPointForBlock ¶ added in v1.4.2
func (filter *FilterVOL) FilterPointForBlock() *dia.FilterPoint
func (*FilterVOL) FinalCompute ¶ added in v1.4.2
type FilterVWAP ¶ added in v1.2.0
type FilterVWAP struct {
// contains filtered or unexported fields
}
FilterVWAP ...
func NewFilterVWAP ¶ added in v1.2.0
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) *FilterVWAPIR
NewFilterVWAP ...
func (*FilterVWAPIR) Compute ¶ added in v1.2.0
func (s *FilterVWAPIR) Compute(trade dia.Trade)
Compute ...
func (*FilterVWAPIR) FilterPointForBlock ¶ added in v1.2.0
func (s *FilterVWAPIR) FilterPointForBlock() *dia.FilterPoint
FilterPointForBlock ...
func (*FilterVWAPIR) FinalCompute ¶ added in v1.2.0
func (s *FilterVWAPIR) FinalCompute(t time.Time) float64
FinalCompute ...
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.