backtest

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OriginEChartsJs = "https://go-echarts.github.io/go-echarts-assets/assets/echarts.min.js"
	MyEChartsJs     = "https://cdnjs.cloudflare.com/ajax/libs/echarts/4.7.0/echarts.min.js"

	OriginEChartsBulmaCss = "https://go-echarts.github.io/go-echarts-assets/assets/bulma.min.css"
	MyEChartsBulmaCss     = "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.8.2/css/bulma.min.css"
)
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(datas []*dataloader.Data, symbol string, start time.Time, end time.Time, 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) HtmlReport added in v1.1.13

func (b *Backtest) HtmlReport()

HTMLReport 创建Html报告文件

func (*Backtest) Plot

func (b *Backtest) Plot()

Plot Output backtest results

func (*Backtest) PlotOld added in v1.1.13

func (b *Backtest) PlotOld()

func (*Backtest) Run

func (b *Backtest) Run()

Run Run backtest

func (*Backtest) SetDatas added in v1.2.2

func (b *Backtest) SetDatas(datas []*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, stdout 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 DataState added in v1.2.2

type DataState struct {
	Time  int64 // ns
	Index int   // datas 中的索引
}

type GetCurrentTime added in v1.1.10

type GetCurrentTime interface {
	GetTime() time.Time
}

type PlotData added in v1.1.13

type PlotData struct {
	NameItems []string
	Prices    []float64
	Equities  []float64
}

type SOrder added in v1.2.0

type SOrder struct {
	Ts        time.Time   // ts: 2019-10-02T07:03:53.584+0800
	Order     *Order      // order
	OrderBook *OrderBook  // orderbook
	Positions []*Position // positions
	Balances  []float64   // balances
	Comment   string      // msg: Place order/Match order
}

SOrder "event":"order"/"deal"

func (*SOrder) BalancesString added in v1.2.4

func (o *SOrder) BalancesString() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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