cancel order when shutdown

This commit is contained in:
c9s 2022-07-01 16:29:03 +08:00
parent c792da2164
commit 7f5e92d1b5
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

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) {
defer wg.Done()
_, _ = fmt.Fprintln(os.Stderr, s.TradeStats.String())
wg.Done()
_ = s.orderExecutor.GracefulCancel(ctx)
})
return nil