mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 01:01:56 +00:00
fix cyclic import issue
This commit is contained in:
parent
6210fe2262
commit
8d01c97240
|
@ -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 {
|
||||
|
|
|
@ -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
6
pkg/types/indicator.go
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user