merge used intervals

This commit is contained in:
c9s 2022-05-20 00:50:58 +08:00
parent ec2f0cd0b1
commit 369afa8ab1
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -462,14 +462,17 @@ var BacktestCmd = &cobra.Command{
} }
allKLineIntervals := map[types.Interval]struct{}{} allKLineIntervals := map[types.Interval]struct{}{}
for _, interval := range backTestIntervals {
allKLineIntervals[interval] = struct{}{}
}
for _, session := range environ.Sessions() { for _, session := range environ.Sessions() {
for _, sub := range session.Subscriptions { for _, sub := range session.Subscriptions {
if sub.Channel == types.KLineChannel { if sub.Channel == types.KLineChannel {
allKLineIntervals[types.Interval(sub.Options.Interval)] = struct{}{} allKLineIntervals[sub.Options.Interval] = struct{}{}
} }
} }
} }
for interval := range allKLineIntervals { for interval := range allKLineIntervals {
summaryReport.Intervals = append(summaryReport.Intervals, interval) summaryReport.Intervals = append(summaryReport.Intervals, interval)
} }
@ -583,7 +586,7 @@ func createSymbolReport(userConfig *bbgo.Config, session *bbgo.ExchangeSession,
sessionKLineIntervals := map[types.Interval]struct{}{} sessionKLineIntervals := map[types.Interval]struct{}{}
for _, sub := range session.Subscriptions { for _, sub := range session.Subscriptions {
if sub.Channel == types.KLineChannel { if sub.Channel == types.KLineChannel {
sessionKLineIntervals[types.Interval(sub.Options.Interval)] = struct{}{} sessionKLineIntervals[sub.Options.Interval] = struct{}{}
} }
} }