mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
bollmaker: apply kline filter closure
This commit is contained in:
parent
c252a7dcf9
commit
8986eeb3a4
|
@ -531,16 +531,12 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
}
|
||||
})
|
||||
|
||||
session.MarketDataStream.OnKLineClosed(func(kline types.KLine) {
|
||||
session.MarketDataStream.OnKLineClosed(types.KLineWith(s.Symbol, s.Interval, func(kline types.KLine) {
|
||||
// StrategyController
|
||||
if s.Status != types.StrategyStatusRunning {
|
||||
return
|
||||
}
|
||||
|
||||
if kline.Symbol != s.Symbol || kline.Interval != s.Interval {
|
||||
return
|
||||
}
|
||||
|
||||
// Update spreads with dynamic spread
|
||||
if s.DynamicSpread.Enabled {
|
||||
s.DynamicSpread.Update(kline)
|
||||
|
@ -570,7 +566,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
} else {
|
||||
s.placeOrders(ctx, kline.Close, &kline)
|
||||
}
|
||||
})
|
||||
}))
|
||||
|
||||
// s.book = types.NewStreamBook(s.Symbol)
|
||||
// s.book.BindStreamForBackground(session.MarketDataStream)
|
||||
|
|
Loading…
Reference in New Issue
Block a user