backtestconfig

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Annually

func Annually() func(t time.Time, _ []float64) bool

func Daily

func Daily() func(t time.Time, _ []float64) bool

func Monthly

func Monthly() func(t time.Time, currentWeights []float64) bool

func Never

func Never() func(t time.Time, currentWeights []float64) bool

func Quarterly

func Quarterly() func(t time.Time, _ []float64) bool

func TruncateTableWithLookBack

func TruncateTableWithLookBack(end, start time.Time, dur Window, table returns.Table) returns.Table

func TruncateWithLookBack

func TruncateWithLookBack(end, start time.Time, dur Window, returns returns.List) returns.List

func Weekly

func Weekly() func(t time.Time, _ []float64) bool

Types

type ConstantWeights

type ConstantWeights []float64

func (ConstantWeights) PolicyWeights

func (targetWeights ConstantWeights) PolicyWeights(_ context.Context, _ time.Time, _ returns.Table, _ []float64) ([]float64, error)

type EqualWeights

type EqualWeights struct{}

func (EqualWeights) PolicyWeights

func (EqualWeights) PolicyWeights(_ context.Context, _ time.Time, assets returns.Table, _ []float64) ([]float64, error)

type Interval

type Interval string
const (
	IntervalDefault            = IntervalNever
	IntervalNever     Interval = "Never"
	IntervalDaily     Interval = "Daily"
	IntervalWeekly    Interval = "Weekly"
	IntervalMonthly   Interval = "Monthly"
	IntervalQuarterly Interval = "Quarterly"
	IntervalAnnually  Interval = "Annually"
)

func Intervals

func Intervals() []Interval

func (Interval) CheckFunction

func (t Interval) CheckFunction() func(t time.Time, currentWeights []float64) bool

func (Interval) Options added in v0.2.0

func (t Interval) Options() []Interval

func (Interval) String

func (t Interval) String() string

func (Interval) Validate

func (t Interval) Validate() error

type IntervalCheckFunc

type IntervalCheckFunc func(t time.Time) bool

type PolicyWeightCalculatorFunc added in v0.1.1

type PolicyWeightCalculatorFunc func(ctx context.Context, today time.Time, assets returns.Table, currentWeights []float64) ([]float64, error)

PolicyWeightCalculatorFunc can be used to wrap a function and pass it into Run as a PolicyWeightCalculator

func (PolicyWeightCalculatorFunc) PolicyWeights added in v0.1.1

func (p PolicyWeightCalculatorFunc) PolicyWeights(ctx context.Context, today time.Time, assets returns.Table, currentWeights []float64) ([]float64, error)

type Window

type Window string
const (
	WindowNotSet     Window = ""
	OneDayWindow     Window = "1 Day"
	OneWeekWindow    Window = "1 Week"
	OneMonthWindow   Window = "1 Month"
	OneQuarterWindow Window = "1 Quarter"
	OneYearWindow    Window = "1 Year"
	ThreeYearWindow  Window = "3 Years"
	FiveYearWindow   Window = "5 Years"
)

func Windows

func Windows() []Window

func (Window) Add

func (dur Window) Add(t time.Time) time.Time

func (Window) Function

func (dur Window) Function(today time.Time, table returns.Table) returns.Table

func (Window) IsSet

func (dur Window) IsSet() bool

func (Window) Options added in v0.2.0

func (dur Window) Options() []Window

func (Window) String

func (dur Window) String() string

func (Window) Sub

func (dur Window) Sub(t time.Time) time.Time

func (Window) Validate

func (dur Window) Validate() error

Jump to

Keyboard shortcuts

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