interval: avoid syncing 1s klines as default from backtest config syncSecKLines

This commit is contained in:
austin362667 2022-10-04 22:04:09 +08:00 committed by Austin Liu
parent 18acd668a7
commit 763bb45842
2 changed files with 6 additions and 0 deletions

View File

@ -138,6 +138,9 @@ type Backtest struct {
Accounts map[string]BacktestAccount `json:"accounts" yaml:"accounts"` Accounts map[string]BacktestAccount `json:"accounts" yaml:"accounts"`
Symbols []string `json:"symbols" yaml:"symbols"` Symbols []string `json:"symbols" yaml:"symbols"`
Sessions []string `json:"sessions" yaml:"sessions"` Sessions []string `json:"sessions" yaml:"sessions"`
// sync 1 second interval KLines
SyncSecKLines bool `json:"syncSecKLines,omitempty" yaml:"syncSecKLines,omitempty"`
} }
func (b *Backtest) GetAccount(n string) BacktestAccount { func (b *Backtest) GetAccount(n string) BacktestAccount {

View File

@ -747,6 +747,9 @@ func sync(ctx context.Context, userConfig *bbgo.Config, backtestService *service
} else { } else {
supportIntervals = types.SupportedIntervals supportIntervals = types.SupportedIntervals
} }
if !userConfig.Backtest.SyncSecKLines {
delete(supportIntervals, types.Interval1s)
}
// sort intervals // sort intervals
var intervals []types.Interval var intervals []types.Interval