strategy

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Typecode    string   `json:"typecode"`
	Default     string   `json:"default"`
	Advanced    bool     `json:"advanced"`
	Options     []string `json:"options"`
}

Argument an argument to a strategy

type Factory

type Factory func(map[string]json.RawMessage) (Strategy, error)

Factory method implementing the Factory pattern to create a new Strategy object

type Info

type Info struct {
	Name            string                       `json:"name"`
	Shortcode       string                       `json:"shortcode"`
	Description     string                       `json:"description"`
	LongDescription string                       `json:"longDescription"`
	Source          string                       `json:"source"`
	Version         string                       `json:"version"`
	Benchmark       data.Security                `json:"benchmark"`
	Arguments       map[string]Argument          `json:"arguments"`
	Suggested       map[string]map[string]string `json:"suggestedParams"`
	Schedule        string                       `json:"Schedule"`
	Metrics         Metrics                      `json:"metrics"`
	Factory         Factory                      `json:"-"`
}

Info information about a strategy

type Metrics

type Metrics struct {
	ID                 uuid.UUID     `json:"id"`
	YTDReturn          pgtype.Float8 `json:"ytdReturn"`
	CagrSinceInception pgtype.Float8 `json:"cagrSinceInception"`
	CagrThreeYr        pgtype.Float4 `json:"cagr3yr"`
	CagrFiveYr         pgtype.Float4 `json:"cagr5yr"`
	CagrTenYr          pgtype.Float4 `json:"cagr10yr"`
	StdDev             pgtype.Float4 `json:"stdDev"`
	DownsideDeviation  pgtype.Float4 `json:"downsideDeviation"`
	MaxDrawDown        pgtype.Float4 `json:"maxDrawDown"`
	AvgDrawDown        pgtype.Float4 `json:"avgDrawDown"`
	SharpeRatio        pgtype.Float4 `json:"sharpeRatio"`
	SortinoRatio       pgtype.Float4 `json:"sortinoRatio"`
	UlcerIndex         pgtype.Float4 `json:"ulcerIndex"`
}

Metrics collection of strategy metrics that should be regularly updated

type Strategy

type Strategy interface {
	// Compute calculates the list of historical trades and returns a dataframe. Additionally, it
	// returns a dataframe that indicates what assets to hold at the next trading time.
	Compute(ctx context.Context, begin, end time.Time) (data.PortfolioPlan, *data.SecurityAllocation, error)
}

Strategy an investing strategy

Jump to

Keyboard shortcuts

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