avoid emitting duplicated kline

This commit is contained in:
c9s 2022-05-20 13:37:28 +08:00
parent b61af0db39
commit b9b2b8727a
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -391,7 +391,13 @@ var BacktestCmd = &cobra.Command{
var numOfExchangeSources = len(exchangeSources)
if numOfExchangeSources == 1 {
exSource := exchangeSources[0]
var lastk types.KLine
for k := range exSource.C {
// avoid duplicated klines
if k == lastk {
continue
}
exSource.Exchange.ConsumeKLine(k)
for _, h := range kLineHandlers {