mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
xmaker: use GracefulCancel to cancel active orders
This commit is contained in:
parent
e91dc5a518
commit
98247385f9
|
@ -162,22 +162,13 @@ func aggregatePrice(pvs types.PriceVolumeSlice, requiredQuantity fixedpoint.Valu
|
|||
}
|
||||
|
||||
func (s *Strategy) updateQuote(ctx context.Context, orderExecutionRouter bbgo.OrderExecutionRouter) {
|
||||
if err := s.makerSession.Exchange.CancelOrders(ctx, s.activeMakerOrders.Orders()...); err != nil {
|
||||
log.WithError(err).Errorf("can not cancel %s orders", s.Symbol)
|
||||
if err := s.activeMakerOrders.GracefulCancel(ctx, s.makerSession.Exchange); err != nil {
|
||||
log.Warnf("there are some %s orders not canceled, skipping placing maker orders", s.Symbol)
|
||||
s.activeMakerOrders.Print()
|
||||
return
|
||||
}
|
||||
|
||||
// avoid unlock issue and wait for the balance update
|
||||
if s.OrderCancelWaitTime > 0 {
|
||||
time.Sleep(s.OrderCancelWaitTime.Duration())
|
||||
} else {
|
||||
// use the default wait time
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
|
||||
if s.activeMakerOrders.NumOfAsks() > 0 || s.activeMakerOrders.NumOfBids() > 0 {
|
||||
log.Warnf("there are some %s orders not canceled, skipping placing maker orders", s.Symbol)
|
||||
s.activeMakerOrders.Print()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user