Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TotalProfitMetricValueFunc = func(summaryReport *backtest.SummaryReport) fixedpoint.Value {
return summaryReport.TotalProfit
}
View Source
var TotalVolume = func(summaryReport *backtest.SummaryReport) fixedpoint.Value { if len(summaryReport.SymbolReports) == 0 { return fixedpoint.Zero } buyVolume := summaryReport.SymbolReports[0].PnL.BuyVolume sellVolume := summaryReport.SymbolReports[0].PnL.SellVolume return buyVolume.Add(sellVolume) }
Functions ¶
This section is empty.
Types ¶
type AsyncHandle ¶ added in v1.36.0
type AsyncHandle struct {
Error error
Report *backtest.SummaryReport
Done chan struct{}
}
type BacktestTask ¶ added in v1.36.0
type BacktestTask struct {
ConfigJson []byte
Params []interface{}
Labels []string
Report *backtest.SummaryReport
Error error
}
type Config ¶
type Config struct {
Executor *ExecutorConfig `json:"executor" yaml:"executor"`
MaxThread int `yaml:"maxThread,omitempty"`
Matrix []SelectorConfig `yaml:"matrix"`
}
func LoadConfig ¶
type Executor ¶
type Executor interface {
// Execute(configJson []byte) (*backtest.SummaryReport, error)
Run(ctx context.Context, taskC chan BacktestTask, bar *pb.ProgressBar) (chan BacktestTask, error)
}
type ExecutorConfig ¶ added in v1.36.0
type ExecutorConfig struct {
Type string `json:"type" yaml:"type"`
LocalExecutorConfig *LocalExecutorConfig `json:"local" yaml:"local"`
}
type GridOptimizer ¶
type LocalExecutorConfig ¶ added in v1.36.0
type LocalExecutorConfig struct {
MaxNumberOfProcesses int `json:"maxNumberOfProcesses" yaml:"maxNumberOfProcesses"`
}
type LocalProcessExecutor ¶
type LocalProcessExecutor struct {
Config *LocalExecutorConfig
Bin string
WorkDir string
ConfigDir string
OutputDir string
}
func (*LocalProcessExecutor) ExecuteAsync ¶ added in v1.36.0
func (e *LocalProcessExecutor) ExecuteAsync(configJson []byte) *AsyncHandle
func (*LocalProcessExecutor) Run ¶ added in v1.36.0
func (e *LocalProcessExecutor) Run(ctx context.Context, taskC chan BacktestTask, bar *pb.ProgressBar) (chan BacktestTask, error)
type Metric ¶
type Metric struct {
// Labels is the labels of the given parameters
Labels []string `json:"labels,omitempty"`
// Params is the parameters used to output the metrics result
Params []interface{} `json:"params,omitempty"`
// Key is the metric name
Key string `json:"key"`
// Value is the metric value of the metric
Value fixedpoint.Value `json:"value,omitempty"`
}
type MetricValueFunc ¶
type MetricValueFunc func(summaryReport *backtest.SummaryReport) fixedpoint.Value
type SelectorConfig ¶
type SelectorConfig struct {
Type string `json:"type" yaml:"type"`
Label string `json:"label,omitempty" yaml:"label,omitempty"`
Path string `json:"path" yaml:"path"`
Values []string `json:"values,omitempty" yaml:"values,omitempty"`
Min fixedpoint.Value `json:"min,omitempty" yaml:"min,omitempty"`
Max fixedpoint.Value `json:"max,omitempty" yaml:"max,omitempty"`
Step fixedpoint.Value `json:"step,omitempty" yaml:"step,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.