backtest

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogTsKey = "log_ts"
)
View Source
const SimpleDateTimeFormat = "2006-01-02 15:04:05.000"

Variables

This section is empty.

Functions

func NewCore added in v1.1.10

NewCore creates a Core that writes logs to a WriteSyncer.

Types

type Backtest

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

func NewBacktest

func NewBacktest(data *dataloader.Data, symbol string, strategy Strategy, exchanges []ExchangeSim, outputDir string) *Backtest

NewBacktest Create backtest data: The data outputDir: 日志输出目录

func (*Backtest) ComputeStats

func (b *Backtest) ComputeStats() (result *Stats)

ComputeStats Calculating Backtest Statistics

func (*Backtest) GetLogs

func (b *Backtest) GetLogs() LogItems

func (*Backtest) GetTime added in v1.1.10

func (b *Backtest) GetTime() time.Time

GetTime get current time

func (*Backtest) Plot

func (b *Backtest) Plot()

Plot Output backtest results

func (*Backtest) Run

func (b *Backtest) Run()

Run Run backtest

func (*Backtest) SetData added in v1.1.10

func (b *Backtest) SetData(data *dataloader.Data)

SetData Set data for backtest

type BtLogger added in v1.1.10

type BtLogger struct {
	Path        string // 文件路径,如:./app.log
	Level       string // 日志输出的级别
	MaxFileSize int    // 日志文件大小的最大值,单位(M)
	MaxBackups  int    // 最多保留备份数
	MaxAge      int    // 日志文件保存的时间,单位(天)
	Compress    bool   // 是否压缩
	Caller      bool   // 日志是否需要显示调用位置
	JsonFormat  bool   // 是否以Json格式输出
	Stdout      bool   // 是否输出到控制台
	// contains filtered or unexported fields
}

func NewBtLogger added in v1.1.10

func NewBtLogger(gct GetCurrentTime, path string, level string, jsonFormat bool) *BtLogger

func (*BtLogger) Debug added in v1.1.10

func (l *BtLogger) Debug(args ...interface{})

func (*BtLogger) Debugf added in v1.1.10

func (l *BtLogger) Debugf(template string, args ...interface{})

func (*BtLogger) Debugw added in v1.1.10

func (l *BtLogger) Debugw(msg string, keysAndValues ...interface{})

func (*BtLogger) Error added in v1.1.10

func (l *BtLogger) Error(args ...interface{})

func (*BtLogger) Errorf added in v1.1.10

func (l *BtLogger) Errorf(template string, args ...interface{})

func (*BtLogger) Errorw added in v1.1.10

func (l *BtLogger) Errorw(msg string, keysAndValues ...interface{})

func (*BtLogger) Info added in v1.1.10

func (l *BtLogger) Info(args ...interface{})

func (*BtLogger) Infof added in v1.1.10

func (l *BtLogger) Infof(template string, args ...interface{})

func (*BtLogger) Infow added in v1.1.10

func (l *BtLogger) Infow(msg string, keysAndValues ...interface{})

func (*BtLogger) Sync added in v1.1.10

func (l *BtLogger) Sync()

func (*BtLogger) Warn added in v1.1.10

func (l *BtLogger) Warn(args ...interface{})

func (*BtLogger) Warnf added in v1.1.10

func (l *BtLogger) Warnf(template string, args ...interface{})

func (*BtLogger) Warnw added in v1.1.10

func (l *BtLogger) Warnw(msg string, keysAndValues ...interface{})

type GetCurrentTime added in v1.1.10

type GetCurrentTime interface {
	GetTime() time.Time
}

Jump to

Keyboard shortcuts

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