indicator: pull out emit update

This commit is contained in:
c9s 2022-07-14 11:36:34 +08:00
parent bbf01275cc
commit 975d0d6995
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -69,14 +69,13 @@ func (inc *SMA) CalculateAndUpdate(allKLines []types.KLine) {
if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) {
continue continue
} }
inc.PushK(k) inc.PushK(k)
inc.EmitUpdate(inc.Values.Last())
} }
} else { } else {
inc.PushK(last) inc.PushK(last)
inc.EmitUpdate(inc.Values.Last())
} }
inc.EmitUpdate(inc.Values.Last())
} }
func (inc *SMA) handleKLineWindowUpdate(interval types.Interval, window types.KLineWindow) { func (inc *SMA) handleKLineWindowUpdate(interval types.Interval, window types.KLineWindow) {