storage

package
v0.0.0-...-ab49fd9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backtest

type Backtest struct {
	ID               string            `json:"id"`
	Strategy         string            `json:"strategy"`
	ExecutionType    string            `json:"execution_type"`
	Config           BacktestConfig    `json:"config"`
	WorkerParameters []WorkerParameter `json:"worker_parameters"`
	Stage            string            `json:"stage"`
	Error            string            `json:"error"`
	Socket           socket.Socket     `json:"socket"`
}

type BacktestConfig

type BacktestConfig struct {
	Calendar  string    `json:"calendar"`
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`
	Benchmark string    `json:"benchmark"`
	Symbols   []string  `json:"symbols"`
}

type BacktestStorage

type BacktestStorage interface {
	List(context.Context, string) ([]*Backtest, error)
	ListByStage(context.Context, ...string) ([]*Backtest, error)
	Create(context.Context, string, *Backtest) error
	Get(context.Context, string) (*Backtest, error)
	Update(context.Context, *Backtest) error
	Delete(context.Context, string) error
}

type Period

type Period struct {
	ID                     int       `json:"-"`
	Period                 time.Time `json:"period" mapstructure:"period"`
	ShortsCount            int       `json:"shorts_count" mapstructure:"shorts_count"`
	PNL                    float64   `json:"pnl" mapstructure:"pnl"`
	LongValue              float64   `json:"long_value" mapstructure:"long_value"`
	ShortValue             float64   `json:"short_value" mapstructure:"short_value"`
	LongExposure           float64   `json:"long_exposure" mapstructure:"long_exposure"`
	StartingExposure       float64   `json:"starting_exposure" mapstructure:"starting_exposure"`
	ShortExposure          float64   `json:"short_exposure" mapstructure:"short_exposure"`
	CapitalUsed            float64   `json:"capital_used" mapstructure:"capital_used"`
	GrossLeverage          float64   `json:"gross_leverage" mapstructure:"gross_leverage"`
	NetLeverage            float64   `json:"net_leverage" mapstructure:"net_leverage"`
	EndingExposure         float64   `json:"ending_exposure" mapstructure:"ending_exposure"`
	StartingValue          float64   `json:"starting_value" mapstructure:"starting_value"`
	EndingValue            float64   `json:"ending_value" mapstructure:"ending_value"`
	StartingCash           float64   `json:"starting_cash" mapstructure:"starting_cash"`
	EndingCash             float64   `json:"ending_cash" mapstructure:"ending_cash"`
	Returns                float64   `json:"returns" mapstructure:"returns"`
	PortfolioValue         float64   `json:"portfolio_value" mapstructure:"portfolio_value"`
	LongsCount             int       `json:"longs_count" mapstructure:"longs_count"`
	AlgoVolatility         float64   `json:"algo_volatility" mapstructure:"algo_volatility"`
	Sharpe                 float64   `json:"sharpe" mapstructure:"sharpe"`
	Alpha                  float64   `json:"alpha" mapstructure:"alpha"`
	Beta                   float64   `json:"beta" mapstructure:"beta"`
	Sortino                float64   `json:"sortino" mapstructure:"sortino"`
	MaxDrawdown            float64   `json:"max_drawdown" mapstructure:"max_drawdown"`
	MaxLeverage            float64   `json:"max_leverage" mapstructure:"max_leverage"`
	ExcessReturns          float64   `json:"excess_returns" mapstructure:"excess_returns"`
	TreasuryPeriodReturn   float64   `json:"treasure_period_return" mapstructure:"treasure_period_return"`
	TradingDays            int       `json:"trading_days" mapstructure:"trading_days"`
	BenchmarkPeriodReturns float64   `json:"benchmark_period_returns" mapstructure:"benchmark_period_returns"`
	BenchmarkVolatility    float64   `json:"benchmark_volatility" mapstructure:"benchmark_volatility"`
	AlgorithmPeriodReturns float64   `json:"algorithm_period_return" mapstructure:"algorithm_period_return"`
}

type PeriodStorage

type PeriodStorage interface {
	List(ctx context.Context, execution string, offset int) ([]*Period, error)
	Store(ctx context.Context, execution string, period *Period) error
}

type Strategy

type Strategy struct {
	Name     string `json:"name" binding:"required"`
	Backtest string `json:"backtest" binding:"required"`
	Worker   string `json:"worker" binding:"required"`
}

type StrategyStorage

type StrategyStorage interface {
	List(context.Context) ([]*Strategy, error)
	Create(context.Context, *Strategy) error
	Get(context.Context, string) (*Strategy, error)
	Update(context.Context, *Strategy) error
	Delete(context.Context, string) error
}

type WorkerParameter

type WorkerParameter struct {
	Key   string `json:"key"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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