mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
fix strategy market data stream usage
This commit is contained in:
parent
4f16f6b1f8
commit
d932a686a0
|
@ -128,7 +128,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
Window: 25,
|
||||
})
|
||||
|
||||
session.UserDataStream.OnKLineClosed(func(kline types.KLine) {
|
||||
session.MarketDataStream.OnKLineClosed(func(kline types.KLine) {
|
||||
s.updateOrders(orderExecutor, session)
|
||||
})
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) {
|
|||
}
|
||||
|
||||
func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error {
|
||||
session.UserDataStream.OnKLine(func(kline types.KLine) {
|
||||
session.MarketDataStream.OnKLine(func(kline types.KLine) {
|
||||
market, ok := session.Market(kline.Symbol)
|
||||
if !ok {
|
||||
return
|
||||
|
|
|
@ -128,7 +128,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
}
|
||||
}
|
||||
|
||||
session.UserDataStream.OnKLineClosed(func(kline types.KLine) {
|
||||
session.MarketDataStream.OnKLineClosed(func(kline types.KLine) {
|
||||
if kline.Symbol != s.Symbol {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
var iw = types.IntervalWindow{Interval: s.Interval, Window: s.MovingAverageWindow}
|
||||
var ema = standardIndicatorSet.EWMA(iw)
|
||||
|
||||
session.UserDataStream.OnKLineClosed(func(kline types.KLine) {
|
||||
session.MarketDataStream.OnKLineClosed(func(kline types.KLine) {
|
||||
// skip k-lines from other symbols
|
||||
if kline.Symbol != s.Symbol {
|
||||
return
|
||||
|
|
|
@ -102,8 +102,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
|
||||
}
|
||||
|
||||
// session.UserDataStream.OnKLineClosed
|
||||
session.UserDataStream.OnKLineClosed(func(kline types.KLine) {
|
||||
session.MarketDataStream.OnKLineClosed(func(kline types.KLine) {
|
||||
// skip k-lines from other symbols
|
||||
if kline.Symbol != s.Symbol {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue
Block a user