ml

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: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeprecatedName = "ml-network"
)
View Source
const (
	Name = "ml-network"
)

Variables

View Source
var SplitOnTrend = func(gap float64) Collect {
	threshold := gap
	return func(trade *model.TradeSignal) []float64 {
		trend := trade.Tick.StatsData.Trend.Price / trade.Tick.Price
		y := make([]float64, 3)
		if trend > threshold {
			y[0] = 1
		} else if trend < -1*threshold {
			y[2] = 1
		} else {
			y[1] = 1
		}
		return y
	}
}

Functions

func CoinConfig

func CoinConfig(coins map[model.Coin]mlmodel.ConfigSegment) *mlmodel.Config

func Config

func Config(coin ...model.Coin) *mlmodel.Config

func ConfigKey

func ConfigKey(coin model.Coin, d int) model.Key

func DeprecatedProcessor

func DeprecatedProcessor(index api.Index, shard storage.Shard, registry storage.EventRegistry, config *mlmodel.Config, networks ...net.ConstructNetwork) func(u api.User, e api.Exchange) api.Processor

Processor is the position processor main routine.

func ForCoin

func ForCoin(coin model.Coin, live bool) func(sgm mlmodel.SegmentConfig) mlmodel.SegmentConfig

func ModelConfig

func ModelConfig(precision float64) mlmodel.Model

func Processor

func Processor(index api.Index, shard storage.Shard, strategy *processor.Strategy) func(u api.User, e api.Exchange) api.Processor

Processor is the position processor main routine.

func ReProcessor

func ReProcessor() (proc api.Processor, err error)

func TraderConfig

func TraderConfig(live bool) mlmodel.Trader

func WithConfig

func WithConfig(coin map[model.Coin]bool) *mlmodel.Config

Types

type Collect

type Collect func(trade *model.TradeSignal) []float64
var CollectStats Collect = func(trade *model.TradeSignal) []float64 {

	trend := 100 * trade.Tick.StatsData.Trend.Price / trade.Tick.Price
	std := trade.Tick.StatsData.Std.Price / trade.Tick.Price
	volume := trade.Tick.StatsData.Std.Volume / trade.Tick.Volume
	size := float64(trade.Meta.Size)
	buyEvents := trade.Tick.StatsData.Buy.Count / size
	sellEvents := trade.Tick.StatsData.Sell.Count / size
	buyVolume := trade.Tick.StatsData.Buy.Volume / trade.Tick.Volume
	sellVolume := trade.Tick.StatsData.Sell.Volume / trade.Tick.Volume
	return []float64{trend, std, volume, buyVolume, buyEvents, sellVolume, sellEvents, size, trade.Tick.Price}
}
var Trend Collect = func(trade *model.TradeSignal) []float64 {

	trend := 100 * trade.Tick.StatsData.Trend.Price / trade.Tick.Price
	return []float64{trend, trade.Tick.Price}
}

type Collector

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

Collector collects trade stats based on the collector functions it groups previous trade stats, so we can join the previous and next stats and can effectively train a model

func NewCollector

func NewCollector(shard storage.Shard, config mlmodel.Config, in, out Collect) (*Collector, error)

type Performance

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

func (Performance) String

func (p Performance) String() string

func (Performance) Value

func (p Performance) Value(lazy bool) float64

type Tracker

type Tracker struct {
	Buffer      *buffer.MultiBuffer
	Performance map[mlmodel.Detail]Performance
	Prediction  map[mlmodel.Detail][][]float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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