Documentation ¶
Index ¶
- Constants
- func NewCore(enc zapcore.Encoder, ws zapcore.WriteSyncer, enab zapcore.LevelEnabler) zapcore.Core
- type Backtest
- func (b *Backtest) ComputeStats() (result *Stats)
- func (b *Backtest) ComputeStatsByIndex(index int) (result *Stats)
- func (b *Backtest) GetLogs(index int) LogItems
- func (b *Backtest) GetPrices() (result []float64)
- func (b *Backtest) GetTime() time.Time
- func (b *Backtest) HtmlReport()
- func (b *Backtest) Plot()
- func (b *Backtest) Run()
- func (b *Backtest) SetDatas(datas []*dataloader.Data)
- type BtLogger
- func (l *BtLogger) Debug(args ...interface{})
- func (l *BtLogger) Debugf(template string, args ...interface{})
- func (l *BtLogger) Debugw(msg string, keysAndValues ...interface{})
- func (l *BtLogger) Error(args ...interface{})
- func (l *BtLogger) Errorf(template string, args ...interface{})
- func (l *BtLogger) Errorw(msg string, keysAndValues ...interface{})
- func (l *BtLogger) Info(args ...interface{})
- func (l *BtLogger) Infof(template string, args ...interface{})
- func (l *BtLogger) Infow(msg string, keysAndValues ...interface{})
- func (l *BtLogger) Sync()
- func (l *BtLogger) Warn(args ...interface{})
- func (l *BtLogger) Warnf(template string, args ...interface{})
- func (l *BtLogger) Warnw(msg string, keysAndValues ...interface{})
- type DataState
- type EmptyLogger
- func (l *EmptyLogger) Debug(args ...interface{})
- func (l *EmptyLogger) Debugf(template string, args ...interface{})
- func (l *EmptyLogger) Debugw(msg string, keysAndValues ...interface{})
- func (l *EmptyLogger) Error(args ...interface{})
- func (l *EmptyLogger) Errorf(template string, args ...interface{})
- func (l *EmptyLogger) Errorw(msg string, keysAndValues ...interface{})
- func (l *EmptyLogger) Info(args ...interface{})
- func (l *EmptyLogger) Infof(template string, args ...interface{})
- func (l *EmptyLogger) Infow(msg string, keysAndValues ...interface{})
- func (l *EmptyLogger) Sync()
- func (l *EmptyLogger) Warn(args ...interface{})
- func (l *EmptyLogger) Warnf(template string, args ...interface{})
- func (l *EmptyLogger) Warnw(msg string, keysAndValues ...interface{})
- type GetCurrentTime
- type PlotData
- type SOrder
- type StrategyTester
- func (t *StrategyTester) CalAnnReturn(s *Stats) float64
- func (t *StrategyTester) CalMaxDrawDown() (result float64)
- func (t *StrategyTester) ComputeStats() (result *Stats)
- func (t *StrategyTester) GetLogs() LogItems
- func (t *StrategyTester) HtmlReport()
- func (t *StrategyTester) Init()
- func (t *StrategyTester) OnExit() error
- func (t *StrategyTester) OnInit() error
- func (t *StrategyTester) OnTick() error
- func (t *StrategyTester) RunEventLoopOnce()
- func (t *StrategyTester) Setup() error
- func (t *StrategyTester) Sync()
- type StrategyTesterParams
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" SimpleDateTimeFormat = "2006-01-02 15:04:05.000" )
View Source
const (
LogTsKey = "log_ts"
)
Variables ¶
This section is empty.
Functions ¶
func NewCore ¶ added in v1.1.10
func NewCore(enc zapcore.Encoder, ws zapcore.WriteSyncer, enab zapcore.LevelEnabler) zapcore.Core
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 创建回测 datas: 数据 symbol: 标 start: 起始时间 end: 结束时间 strategy: 策略 exchanges: 交易所对象 outputDir: 回测输出目录
func NewBacktestFromParams ¶ added in v1.2.6
func NewBacktestFromParams(datas []*dataloader.Data, symbol string, start time.Time, end time.Time, strategyParamsList []*StrategyTesterParams, outputDir string) *Backtest
NewBacktest 创建回测 datas: 数据 symbol: 标 start: 起始时间 end: 结束时间 strategyHold: 策略和交易所 outputDir: 回测输出目录
func (*Backtest) ComputeStats ¶
func (b *Backtest) ComputeStats() (result *Stats)
ComputeStats Calculating Backtest Statistics
func (*Backtest) ComputeStatsByIndex ¶ added in v1.2.7
func (*Backtest) HtmlReport ¶ added in v1.1.13
func (b *Backtest) HtmlReport()
HTMLReport 创建Html报告文件
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
type EmptyLogger ¶ added in v1.2.7
type EmptyLogger struct { }
func (*EmptyLogger) Debug ¶ added in v1.2.7
func (l *EmptyLogger) Debug(args ...interface{})
func (*EmptyLogger) Debugf ¶ added in v1.2.7
func (l *EmptyLogger) Debugf(template string, args ...interface{})
func (*EmptyLogger) Debugw ¶ added in v1.2.7
func (l *EmptyLogger) Debugw(msg string, keysAndValues ...interface{})
func (*EmptyLogger) Error ¶ added in v1.2.7
func (l *EmptyLogger) Error(args ...interface{})
func (*EmptyLogger) Errorf ¶ added in v1.2.7
func (l *EmptyLogger) Errorf(template string, args ...interface{})
func (*EmptyLogger) Errorw ¶ added in v1.2.7
func (l *EmptyLogger) Errorw(msg string, keysAndValues ...interface{})
func (*EmptyLogger) Info ¶ added in v1.2.7
func (l *EmptyLogger) Info(args ...interface{})
func (*EmptyLogger) Infof ¶ added in v1.2.7
func (l *EmptyLogger) Infof(template string, args ...interface{})
func (*EmptyLogger) Infow ¶ added in v1.2.7
func (l *EmptyLogger) Infow(msg string, keysAndValues ...interface{})
func (*EmptyLogger) Sync ¶ added in v1.2.7
func (l *EmptyLogger) Sync()
func (*EmptyLogger) Warn ¶ added in v1.2.7
func (l *EmptyLogger) Warn(args ...interface{})
func (*EmptyLogger) Warnf ¶ added in v1.2.7
func (l *EmptyLogger) Warnf(template string, args ...interface{})
func (*EmptyLogger) Warnw ¶ added in v1.2.7
func (l *EmptyLogger) Warnw(msg string, keysAndValues ...interface{})
type GetCurrentTime ¶ added in v1.1.10
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
type StrategyTester ¶ added in v1.2.6
type StrategyTester struct { *StrategyTesterParams // contains filtered or unexported fields }
func (*StrategyTester) CalAnnReturn ¶ added in v1.2.7
func (t *StrategyTester) CalAnnReturn(s *Stats) float64
计算年化收益
func (*StrategyTester) CalMaxDrawDown ¶ added in v1.2.7
func (t *StrategyTester) CalMaxDrawDown() (result float64)
计算最大回撤
func (*StrategyTester) ComputeStats ¶ added in v1.2.6
func (t *StrategyTester) ComputeStats() (result *Stats)
ComputeStats Calculating Backtest Statistics
func (*StrategyTester) GetLogs ¶ added in v1.2.6
func (t *StrategyTester) GetLogs() LogItems
func (*StrategyTester) HtmlReport ¶ added in v1.2.6
func (t *StrategyTester) HtmlReport()
HTMLReport 创建Html报告文件
func (*StrategyTester) Init ¶ added in v1.2.6
func (t *StrategyTester) Init()
func (*StrategyTester) OnExit ¶ added in v1.2.6
func (t *StrategyTester) OnExit() error
func (*StrategyTester) OnInit ¶ added in v1.2.6
func (t *StrategyTester) OnInit() error
func (*StrategyTester) OnTick ¶ added in v1.2.6
func (t *StrategyTester) OnTick() error
func (*StrategyTester) RunEventLoopOnce ¶ added in v1.2.6
func (t *StrategyTester) RunEventLoopOnce()
func (*StrategyTester) Setup ¶ added in v1.2.6
func (t *StrategyTester) Setup() error
func (*StrategyTester) Sync ¶ added in v1.2.6
func (t *StrategyTester) Sync()
type StrategyTesterParams ¶ added in v1.2.6
type StrategyTesterParams struct {
// contains filtered or unexported fields
}
func NewStrategyTesterParams ¶ added in v1.2.7
func NewStrategyTesterParams(strategy Strategy, exchanges []ExchangeSim) *StrategyTesterParams
Source Files ¶
Click to show internal directories.
Click to hide internal directories.