fix cyclic import issue

This commit is contained in:
c9s 2021-08-26 11:46:02 +08:00
parent 6210fe2262
commit 8d01c97240
3 changed files with 9 additions and 8 deletions

View File

@ -3,7 +3,6 @@ package bbgo
import (
"fmt"
"github.com/c9s/bbgo/pkg/fixedpoint"
"github.com/c9s/bbgo/pkg/strategy/schedule"
"github.com/c9s/bbgo/pkg/types"
)
@ -29,7 +28,7 @@ func (settings MovingAverageSettings) IntervalWindow() types.IntervalWindow {
}
}
func (settings *MovingAverageSettings) Indicator(indicatorSet *StandardIndicatorSet) (inc schedule.Float64Indicator, err error) {
func (settings *MovingAverageSettings) Indicator(indicatorSet *StandardIndicatorSet) (inc types.Float64Indicator, err error) {
var iw = settings.IntervalWindow()
switch settings.Type {

View File

@ -16,10 +16,6 @@ func init() {
bbgo.RegisterStrategy(ID, &Strategy{})
}
// Float64Indicator is the indicators (SMA and EWMA) that we want to use are returning float64 data.
type Float64Indicator interface {
Last() float64
}
type Strategy struct {
Market types.Market
@ -76,8 +72,8 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
return errors.New("StandardIndicatorSet can not be nil, injection failed?")
}
var belowMA Float64Indicator
var aboveMA Float64Indicator
var belowMA types.Float64Indicator
var aboveMA types.Float64Indicator
var err error
if s.BelowMovingAverage != nil {
belowMA, err = s.BelowMovingAverage.Indicator(s.StandardIndicatorSet)

6
pkg/types/indicator.go Normal file
View File

@ -0,0 +1,6 @@
package types
// Float64Indicator is the indicators (SMA and EWMA) that we want to use are returning float64 data.
type Float64Indicator interface {
Last() float64
}