diff --git a/pkg/indicator/inf.go b/pkg/indicator/inf.go index 11c3cc43e..ba76cfcb1 100644 --- a/pkg/indicator/inf.go +++ b/pkg/indicator/inf.go @@ -22,12 +22,6 @@ type KLinePusher interface { PushK(k types.KLine) } -// KLineLoader provides an interface for API user to load history klines to the indicator. -// The indicator implements its own way to calculate the values from the given history kline array. -type KLineLoader interface { - LoadK(allKLines []types.KLine) -} - type KLineCalculateUpdater interface { CalculateAndUpdate(allKLines []types.KLine) } diff --git a/pkg/indicator/pivot_low.go b/pkg/indicator/pivot_low.go index 43e7331e5..4c066e9af 100644 --- a/pkg/indicator/pivot_low.go +++ b/pkg/indicator/pivot_low.go @@ -9,8 +9,6 @@ import ( "github.com/c9s/bbgo/pkg/types" ) - - //go:generate callbackgen -type PivotLow type PivotLow struct { types.IntervalWindow @@ -55,37 +53,6 @@ func (inc *PivotLow) PushK(k types.KLine) { inc.EmitUpdate(inc.Last()) } -func (inc *PivotLow) LoadK(allKLines []types.KLine) { - for _, k := range allKLines { - inc.PushK(k) - } -} - -func (inc *PivotLow) CalculateAndUpdate(allKLines []types.KLine) { - if len(inc.Values) == 0 { - for _, k := range allKLines { - inc.PushK(k) - } - inc.EmitUpdate(inc.Last()) - } else { - k := allKLines[len(allKLines)-1] - inc.PushK(k) - inc.EmitUpdate(inc.Last()) - } -} - -func (inc *PivotLow) handleKLineWindowUpdate(interval types.Interval, window types.KLineWindow) { - if inc.Interval != interval { - return - } - - inc.CalculateAndUpdate(window) -} - -func (inc *PivotLow) Bind(updater KLineWindowUpdater) { - updater.OnKLineWindowUpdate(inc.handleKLineWindowUpdate) -} - func calculatePivotLow(lows types.Float64Slice, window int) (float64, error) { length := len(lows) if length == 0 || length < window {