From 975d0d69951c1717abfe0fc4ac305960255ea1c1 Mon Sep 17 00:00:00 2001 From: c9s Date: Thu, 14 Jul 2022 11:36:34 +0800 Subject: [PATCH] indicator: pull out emit update --- pkg/indicator/sma.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/indicator/sma.go b/pkg/indicator/sma.go index 070a1238b..7f5fa65b9 100644 --- a/pkg/indicator/sma.go +++ b/pkg/indicator/sma.go @@ -69,14 +69,13 @@ func (inc *SMA) CalculateAndUpdate(allKLines []types.KLine) { if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { continue } - inc.PushK(k) - inc.EmitUpdate(inc.Values.Last()) } } else { inc.PushK(last) - inc.EmitUpdate(inc.Values.Last()) } + + inc.EmitUpdate(inc.Values.Last()) } func (inc *SMA) handleKLineWindowUpdate(interval types.Interval, window types.KLineWindow) {