mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
scmaker: graceful cancel orders
This commit is contained in:
parent
98a78b5224
commit
58a13507bc
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"sync"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
|
@ -152,6 +153,16 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
}
|
||||
})
|
||||
|
||||
bbgo.OnShutdown(ctx, func(ctx context.Context, wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
|
||||
err := s.liquidityOrderBook.GracefulCancel(ctx, s.session.Exchange)
|
||||
logErr(err, "unable to cancel liquidity orders")
|
||||
|
||||
err = s.adjustmentOrderBook.GracefulCancel(ctx, s.session.Exchange)
|
||||
logErr(err, "unable to cancel adjustment orders")
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user