mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
pkg: add more logs
This commit is contained in:
parent
3e087e8af3
commit
a392d8d579
|
@ -199,10 +199,10 @@ func (b *ActiveOrderBook) GracefulCancel(ctx context.Context, ex types.Exchange,
|
|||
|
||||
// since ctx might be canceled, we should use background context here
|
||||
if err := ex.CancelOrders(context.Background(), orders...); err != nil {
|
||||
log.WithError(err).Warnf("[ActiveOrderBook] can not cancel %s orders", b.Symbol)
|
||||
log.WithError(err).Warnf("[ActiveOrderBook] can not cancel %d %s orders", len(orders), b.Symbol)
|
||||
}
|
||||
|
||||
log.Debugf("[ActiveOrderBook] waiting %s for %s orders to be cancelled...", waitTime, b.Symbol)
|
||||
log.Debugf("[ActiveOrderBook] waiting %s for %d %s orders to be cancelled...", waitTime, len(orders), b.Symbol)
|
||||
|
||||
if cancelAll {
|
||||
clear, err := b.waitAllClear(ctx, waitTime, orderCancelTimeout)
|
||||
|
@ -215,11 +215,11 @@ func (b *ActiveOrderBook) GracefulCancel(ctx context.Context, ex types.Exchange,
|
|||
}
|
||||
|
||||
if clear {
|
||||
log.Debugf("[ActiveOrderBook] %s orders are canceled", b.Symbol)
|
||||
log.Debugf("[ActiveOrderBook] %d %s orders are canceled", len(orders), b.Symbol)
|
||||
break
|
||||
}
|
||||
|
||||
log.Warnf("[ActiveOrderBook] %d %s orders are not cancelled yet:", b.NumOfOrders(), b.Symbol)
|
||||
log.Warnf("[ActiveOrderBook] %d/%d %s orders are not cancelled yet", b.NumOfOrders(), len(orders), b.Symbol)
|
||||
b.Print()
|
||||
|
||||
} else {
|
||||
|
|
|
@ -513,12 +513,12 @@ func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err
|
|||
req.Symbol(order.Symbol)
|
||||
|
||||
if err := cancelOrderRateLimiter.Wait(ctx); err != nil {
|
||||
errs = multierr.Append(errs, fmt.Errorf("cancel order rate limiter wait, order id: %s, error: %w", order.ClientOrderID, err))
|
||||
errs = multierr.Append(errs, fmt.Errorf("cancel order rate limiter wait, orderId: %d, clientOrderId: %s, error: %w", order.OrderID, order.ClientOrderID, err))
|
||||
continue
|
||||
}
|
||||
res, err := req.Do(ctx)
|
||||
if err != nil {
|
||||
errs = multierr.Append(errs, fmt.Errorf("failed to cancel order id: %s, err: %w", order.ClientOrderID, err))
|
||||
errs = multierr.Append(errs, fmt.Errorf("failed to cancel orderId: %d, clientOrderId: %s, err: %w", order.OrderID, order.ClientOrderID, err))
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user