From 405f9c863f4be0c3671f9946a3c90962eb0e3148 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 10 May 2021 01:47:17 +0800 Subject: [PATCH] xmaker: call cancel orders everytime --- pkg/strategy/xmaker/strategy.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/strategy/xmaker/strategy.go b/pkg/strategy/xmaker/strategy.go index 59688ff3a..6939cb7d2 100644 --- a/pkg/strategy/xmaker/strategy.go +++ b/pkg/strategy/xmaker/strategy.go @@ -512,13 +512,13 @@ func (s *Strategy) CrossRun(ctx context.Context, _ bbgo.OrderExecutionRouter, se time.Sleep(1 * time.Second) - if err := s.makerSession.Exchange.CancelOrders(ctx, s.activeMakerOrders.Orders()...); err != nil { - log.WithError(err).Errorf("can not cancel %s orders", s.Symbol) - } - for { + if err := s.makerSession.Exchange.CancelOrders(ctx, s.activeMakerOrders.Orders()...); err != nil { + log.WithError(err).Errorf("can not cancel %s orders", s.Symbol) + } + log.Warnf("waiting for orders to be cancelled...") - time.Sleep(1 * time.Second) + time.Sleep(3 * time.Second) orders := s.activeMakerOrders.Orders() if len(orders) == 0 {