xmaker: call cancel orders everytime

This commit is contained in:
c9s 2021-05-10 01:47:17 +08:00
parent ce63641d70
commit 405f9c863f

View File

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