Skip to content

Commit 7f5e92d

Browse files
committed
cancel order when shutdown
1 parent c792da2 commit 7f5e92d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/strategy/pivotshort/strategy.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,10 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
266266
}
267267

268268
bbgo.OnShutdown(func(ctx context.Context, wg *sync.WaitGroup) {
269+
defer wg.Done()
270+
269271
_, _ = fmt.Fprintln(os.Stderr, s.TradeStats.String())
270-
wg.Done()
272+
_ = s.orderExecutor.GracefulCancel(ctx)
271273
})
272274

273275
return nil

0 commit comments

Comments
 (0)