mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
bbgo: narrow down indicator interface type
This commit is contained in:
parent
3adeb46c65
commit
3fbc634d81
|
@ -25,7 +25,7 @@ type StandardIndicatorSet struct {
|
||||||
// interval -> window
|
// interval -> window
|
||||||
boll map[types.IntervalWindowBandWidth]*indicator.BOLL
|
boll map[types.IntervalWindowBandWidth]*indicator.BOLL
|
||||||
stoch map[types.IntervalWindow]*indicator.STOCH
|
stoch map[types.IntervalWindow]*indicator.STOCH
|
||||||
simples map[types.IntervalWindow]indicator.Simple
|
simples map[types.IntervalWindow]indicator.KLinePusher
|
||||||
|
|
||||||
stream types.Stream
|
stream types.Stream
|
||||||
store *MarketDataStore
|
store *MarketDataStore
|
||||||
|
@ -36,7 +36,7 @@ func NewStandardIndicatorSet(symbol string, stream types.Stream, store *MarketDa
|
||||||
Symbol: symbol,
|
Symbol: symbol,
|
||||||
store: store,
|
store: store,
|
||||||
stream: stream,
|
stream: stream,
|
||||||
simples: make(map[types.IntervalWindow]indicator.Simple),
|
simples: make(map[types.IntervalWindow]indicator.KLinePusher),
|
||||||
|
|
||||||
boll: make(map[types.IntervalWindowBandWidth]*indicator.BOLL),
|
boll: make(map[types.IntervalWindowBandWidth]*indicator.BOLL),
|
||||||
stoch: make(map[types.IntervalWindow]*indicator.STOCH),
|
stoch: make(map[types.IntervalWindow]*indicator.STOCH),
|
||||||
|
@ -53,7 +53,7 @@ func (s *StandardIndicatorSet) initAndBind(inc indicator.KLinePusher, iw types.I
|
||||||
s.stream.OnKLineClosed(types.KLineWith(s.Symbol, iw.Interval, inc.PushK))
|
s.stream.OnKLineClosed(types.KLineWith(s.Symbol, iw.Interval, inc.PushK))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StandardIndicatorSet) allocateSimpleIndicator(t indicator.Simple, iw types.IntervalWindow) indicator.Simple {
|
func (s *StandardIndicatorSet) allocateSimpleIndicator(t indicator.KLinePusher, iw types.IntervalWindow) indicator.KLinePusher {
|
||||||
inc, ok := s.simples[iw]
|
inc, ok := s.simples[iw]
|
||||||
if ok {
|
if ok {
|
||||||
return inc
|
return inc
|
||||||
|
|
Loading…
Reference in New Issue
Block a user