mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
let SMA indicator and EWMA indicator use IntervalWindow type
This commit is contained in:
parent
2f8bffeaca
commit
c71f013916
|
@ -42,7 +42,7 @@ func NewStandardIndicatorSet(symbol string, store *MarketDataStore) *StandardInd
|
|||
func (set *StandardIndicatorSet) GetSMA(iw types.IntervalWindow) *indicator.SMA {
|
||||
inc, ok := set.SMA[iw]
|
||||
if !ok {
|
||||
inc := &indicator.SMA{Interval: iw.Interval, Window: iw.Window}
|
||||
inc := &indicator.SMA{IntervalWindow: iw}
|
||||
inc.Bind(set.store)
|
||||
set.SMA[iw] = inc
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ func (set *StandardIndicatorSet) GetSMA(iw types.IntervalWindow) *indicator.SMA
|
|||
func (set *StandardIndicatorSet) GetEWMA(iw types.IntervalWindow) *indicator.EWMA {
|
||||
inc, ok := set.EWMA[iw]
|
||||
if !ok {
|
||||
inc := &indicator.EWMA{Interval: iw.Interval, Window: iw.Window}
|
||||
inc := &indicator.EWMA{IntervalWindow: iw}
|
||||
inc.Bind(set.store)
|
||||
set.EWMA[iw] = inc
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@ import (
|
|||
)
|
||||
|
||||
type EWMA struct {
|
||||
Interval types.Interval
|
||||
Window int
|
||||
types.IntervalWindow
|
||||
Values Float64Slice
|
||||
EndTime time.Time
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ func (s *Float64Slice) Push(v float64) {
|
|||
var zeroTime time.Time
|
||||
|
||||
type SMA struct {
|
||||
Interval types.Interval
|
||||
Window int
|
||||
types.IntervalWindow
|
||||
Values Float64Slice
|
||||
EndTime time.Time
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user