Merge pull request #790 from c9s/strategy/pivotshort

fix: strategy: pivoshort: cancel order when shutdown
This commit is contained in:
Yo-An Lin 2022-07-01 16:56:16 +08:00 committed by GitHub
commit 0057fe517a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -266,8 +266,10 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
} }
bbgo.OnShutdown(func(ctx context.Context, wg *sync.WaitGroup) { bbgo.OnShutdown(func(ctx context.Context, wg *sync.WaitGroup) {
defer wg.Done()
_, _ = fmt.Fprintln(os.Stderr, s.TradeStats.String()) _, _ = fmt.Fprintln(os.Stderr, s.TradeStats.String())
wg.Done() _ = s.orderExecutor.GracefulCancel(ctx)
}) })
return nil return nil