Documentation
¶
Index ¶
- func SetConfig(c zexchange.Config)
- type Backtest
- func (b *Backtest) CloseAllWhenFinished(bCloseAll bool)
- func (b *Backtest) IsRunning() (ret bool)
- func (b *Backtest) Progress() (progress int)
- func (b *Backtest) Result() (result any, err error)
- func (b *Backtest) Run() (err error)
- func (b *Backtest) SetBalanceInit(balanceInit, fee float64)
- func (b *Backtest) SetLever(lever float64)
- func (b *Backtest) SetLoadDBOnce(loadOnce int)
- func (b *Backtest) SetReporter(rpt rpt.Reporter)
- func (b *Backtest) SetRiskConfig(cfg *risk.RiskConfig)
- func (b *Backtest) SetScript(scriptFile string)
- func (b *Backtest) Start() (err error)
- func (b *Backtest) Stop() (err error)
- type Builder
- type DataDownload
- func (d *DataDownload) AutoRun() (err error)
- func (d *DataDownload) Progress() (progress int)
- func (d *DataDownload) Result() (err error)
- func (d *DataDownload) Run() (err error)
- func (d *DataDownload) SetBinSize(binSize string)
- func (d *DataDownload) Start() (err error)
- func (d *DataDownload) Stop() (err error)
- type LocalData
- type LocalDataInfo
- type Scripter
- type Trade
- func (b *Trade) AddScript(name, scriptFile, param string) (err error)
- func (b *Trade) RemoveScript(name string) (err error)
- func (b *Trade) Run() (err error)
- func (b *Trade) ScriptCount() int
- func (b *Trade) SetLoadRecent(recent time.Duration)
- func (b *Trade) SetReporter(rpt rpt.Reporter)
- func (b *Trade) SetRiskConfig(cfg *risk.RiskConfig)
- func (b *Trade) SetStatusCh(ch chan *goscript.Status)
- func (b *Trade) Start() (err error)
- func (b *Trade) Stop() (err error)
- func (b *Trade) Wait() (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backtest ¶
type Backtest struct {
// contains filtered or unexported fields
}
func NewBacktest ¶
func NewBacktest(db *dbstore.DBStore, exchange, symbol, param string, start time.Time, end time.Time) (b *Backtest, err error)
NewBacktest constructor of Backtest
func (*Backtest) CloseAllWhenFinished ¶ added in v0.1.3
func (*Backtest) Result ¶
Result return the result of current backtest. If the Reporter implements rpt.ResultProvider, returns the structured result. Must be called after the backtest has finished.
func (*Backtest) Run ¶
Run run backtest. Always uses 1m as base data. Strategies should use engine.Merge() to synthesize larger timeframes (5m, 1h, etc.).
func (*Backtest) SetBalanceInit ¶
func (*Backtest) SetLoadDBOnce ¶ added in v0.0.5
func (*Backtest) SetReporter ¶
func (*Backtest) SetRiskConfig ¶ added in v0.3.3
func (b *Backtest) SetRiskConfig(cfg *risk.RiskConfig)
type Builder ¶ added in v0.0.6
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶ added in v0.0.6
func (*Builder) SetKeepTemp ¶ added in v0.0.6
type DataDownload ¶
type DataDownload struct {
// contains filtered or unexported fields
}
func NewDataDownload ¶
func NewDataDownload(cfg *viper.Viper, db *dbstore.DBStore, exchange, symbol, binSize string, start time.Time, end time.Time) (d *DataDownload)
NewDataDownload constructor of DataDownload
func NewDataDownloadAuto ¶
func NewDataDownloadAuto(cfg *viper.Viper, db *dbstore.DBStore, exchange, symbol, binSize string) (d *DataDownload)
NewDataDownload constructor of DataDownload
func (*DataDownload) AutoRun ¶
func (d *DataDownload) AutoRun() (err error)
func (*DataDownload) Progress ¶
func (d *DataDownload) Progress() (progress int)
Progress return the progress of current backtest
func (*DataDownload) Result ¶
func (d *DataDownload) Result() (err error)
Result return the result of current backtest must call after end of the backtest
func (*DataDownload) Run ¶
func (d *DataDownload) Run() (err error)
Run run backtest and wait for finish
func (*DataDownload) SetBinSize ¶
func (d *DataDownload) SetBinSize(binSize string)
type LocalData ¶
type LocalData struct {
// contains filtered or unexported fields
}
func (*LocalData) ListAll ¶
func (l *LocalData) ListAll() (infos []LocalDataInfo, err error)
type Scripter ¶
type Trade ¶
type Trade struct {
// contains filtered or unexported fields
}
Trade trade with multi scripts
func NewTrade ¶
NewTrade constructor of Trade, uses global config set by SetConfig. Prefer NewTradeWithConfig for explicit config injection.
func NewTradeWithConfig ¶ added in v0.3.3
NewTradeWithConfig constructor of Trade with explicit config injection.
func (*Trade) RemoveScript ¶
func (*Trade) ScriptCount ¶ added in v0.0.6
func (*Trade) SetLoadRecent ¶ added in v0.0.5
func (*Trade) SetReporter ¶
func (*Trade) SetRiskConfig ¶ added in v0.3.3
func (b *Trade) SetRiskConfig(cfg *risk.RiskConfig)