From a28081a5d284119c39244d8e68839777e0a582d0 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 13 Jun 2023 12:22:43 +0800 Subject: [PATCH] xalign: add more checks --- pkg/strategy/xalign/strategy.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/strategy/xalign/strategy.go b/pkg/strategy/xalign/strategy.go index aa30d7412..d50c9f114 100644 --- a/pkg/strategy/xalign/strategy.go +++ b/pkg/strategy/xalign/strategy.go @@ -236,9 +236,9 @@ func (s *Strategy) CrossRun(ctx context.Context, _ bbgo.OrderExecutionRouter, se orderBook := bbgo.NewActiveOrderBook("") orderBook.BindStream(session.UserDataStream) + s.orderBooks[sessionName] = orderBook s.sessions[sessionName] = session - s.orderBooks[sessionName] = orderBook } bbgo.OnShutdown(ctx, func(ctx context.Context, wg *sync.WaitGroup) { @@ -313,6 +313,7 @@ func (s *Strategy) align(ctx context.Context, sessions map[string]*bbgo.Exchange } else { log.Errorf("orderbook %s not found", selectedSession.Name) } + s.orderBooks[selectedSession.Name].Add(*createdOrder) } } }