indicator/rma: move endTime update to PushK

This commit is contained in:
c9s 2022-07-14 16:13:45 +08:00
parent ed91fdc915
commit 4300e00580
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -69,6 +69,7 @@ var _ types.SeriesExtend = &RMA{}
func (inc *RMA) PushK(k types.KLine) { func (inc *RMA) PushK(k types.KLine) {
inc.Update(k.Close.Float64()) inc.Update(k.Close.Float64())
inc.EndTime = k.EndTime.Time()
} }
func (inc *RMA) CalculateAndUpdate(kLines []types.KLine) { func (inc *RMA) CalculateAndUpdate(kLines []types.KLine) {
@ -87,7 +88,6 @@ func (inc *RMA) CalculateAndUpdate(kLines []types.KLine) {
} }
inc.EmitUpdate(inc.Last()) inc.EmitUpdate(inc.Last())
inc.EndTime = last.EndTime.Time()
} }
func (inc *RMA) handleKLineWindowUpdate(interval types.Interval, window types.KLineWindow) { func (inc *RMA) handleKLineWindowUpdate(interval types.Interval, window types.KLineWindow) {