processor

package
v0.0.0-...-e2be882 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

README

Processors

Stats

Stats is the basic stats analysis on the previous price moves.

  • splits the price movements in x intervals of size t.
  • maps the change ratio (price_diff / price) to a range of discreet values (rounded logarithm).
  • predicts the next k intervals based on the previous l ones, using a hidden markov model.

Documentation

Index

Constants

View Source
const (
	Name = "void"
)

Variables

This section is empty.

Functions

func Audit

func Audit(name, msg string) string

Audit creates an audit message part for the user.

func Error

func Error(name string, err error) string

Error creates an error message part for the user.

func History

func History(name string, coin model.Coin, dir string) api.Processor

History is a grouping processor for past trades.

func NewStateKey

func NewStateKey(processor string, key model.Key) storage.Key

NewStateKey creates a stats internal state key for the registry storage

func NoProcess

func NoProcess(name string) api.Processor

NoProcess is a wrapper for no processor logic

func Process

func Process(name string, p func(trade *model.TradeSignal) error) api.Processor

Process is a wrapper for a processor logic.

func ProcessBufferedWithClose

func ProcessBufferedWithClose(name string, duration time.Duration, live bool, p func(trade *model.TradeSignal) error, shutdown func(), enrich ...Enrich) api.Processor

ProcessBufferedWithClose is a wrapper for a processor logic with a close execution func and buffering logic.

func ProcessWithClose

func ProcessWithClose(name string, p func(trade *model.TradeSignal) error, shutdown func()) api.Processor

ProcessWithClose is a wrapper for a processor logic with a close execution func.

func Void

func Void(name string) api.Processor

Void is a pass-through processor that only propagates trades to the next one.

Types

type Enrich

type Enrich func(trade *model.TradeSignal) *model.TradeSignal

Enrich defines a function that will enrich the trade

func Deriv

func Deriv() Enrich

Deriv defines a processor that will calculate derived values for the trade in this case it is the derivative of first and last value

type SignalBuffer

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

SignalBuffer is a consistent signal source that will emit a signal each pre-specified interval.

func NewSignalBuffer

func NewSignalBuffer(duration time.Duration) (*SignalBuffer, <-chan *model.TradeSignal)

NewSignalBuffer creates a new trade buffer.

func (*SignalBuffer) Close

func (sb *SignalBuffer) Close()

func (*SignalBuffer) NoLive

func (sb *SignalBuffer) NoLive() *SignalBuffer

func (*SignalBuffer) Push

func (sb *SignalBuffer) Push(trade *model.TradeSignal)

Push adds an element ot the buffer.

func (*SignalBuffer) WithEcho

func (sb *SignalBuffer) WithEcho() *SignalBuffer

type Strategy

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

Strategy is responsible for making a call on weather the signal is good enough to trade on.

func NewStrategy

func NewStrategy(segments *mlmodel.Config) *Strategy

func (*Strategy) Config

func (s *Strategy) Config() mlmodel.Config

func (*Strategy) EnableML

func (s *Strategy) EnableML(c model.Coin, enabled bool) map[string]bool

func (*Strategy) EnableTrader

func (s *Strategy) EnableTrader(c model.Coin, enabled bool) map[string]bool

func (*Strategy) Eval

func (s *Strategy) Eval(trade model.Tick, signal mlmodel.Signal, config *mlmodel.Config) (mlmodel.Signal, model.Key, bool, bool)

func (*Strategy) IsEnabledML

func (s *Strategy) IsEnabledML(k model.Key) bool

func (*Strategy) IsEnabledTrader

func (s *Strategy) IsEnabledTrader(k model.Key) bool

func (*Strategy) IsLive

func (s *Strategy) IsLive(coin model.Coin, trade model.Tick) (bool, bool)

func (*Strategy) Reset

func (s *Strategy) Reset(key model.Key) bool

Reset assesses the current signal validity

func (*Strategy) SetGap

func (s *Strategy) SetGap(coin model.Coin, gap float64) mlmodel.Config

func (*Strategy) SetPrecisionThreshold

func (s *Strategy) SetPrecisionThreshold(coin model.Coin, network string, precision float64) mlmodel.Config

Directories

Path Synopsis
ml
net

Jump to

Keyboard shortcuts

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