mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
fix cyclic import issue
This commit is contained in:
parent
6210fe2262
commit
8d01c97240
|
@ -3,7 +3,6 @@ package bbgo
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||||
"github.com/c9s/bbgo/pkg/strategy/schedule"
|
|
||||||
"github.com/c9s/bbgo/pkg/types"
|
"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()
|
var iw = settings.IntervalWindow()
|
||||||
|
|
||||||
switch settings.Type {
|
switch settings.Type {
|
||||||
|
|
|
@ -16,10 +16,6 @@ func init() {
|
||||||
bbgo.RegisterStrategy(ID, &Strategy{})
|
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 {
|
type Strategy struct {
|
||||||
Market types.Market
|
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?")
|
return errors.New("StandardIndicatorSet can not be nil, injection failed?")
|
||||||
}
|
}
|
||||||
|
|
||||||
var belowMA Float64Indicator
|
var belowMA types.Float64Indicator
|
||||||
var aboveMA Float64Indicator
|
var aboveMA types.Float64Indicator
|
||||||
var err error
|
var err error
|
||||||
if s.BelowMovingAverage != nil {
|
if s.BelowMovingAverage != nil {
|
||||||
belowMA, err = s.BelowMovingAverage.Indicator(s.StandardIndicatorSet)
|
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