bollmaker: apply kline filter closure

This commit is contained in:
c9s 2022-07-26 11:40:03 +08:00
parent c252a7dcf9
commit 8986eeb3a4
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -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)