Skip to content

Commit

Permalink
consider cancel order not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
uv-orbs committed Mar 19, 2024
1 parent bf683f2 commit af71d1c
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions service/cancel_orders_for_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@ func (s *Service) CancelOrdersForUser(ctx context.Context, userId uuid.UUID, sym
if err != nil {
logctx.Error(ctx, "could not get order", logger.Error(err), logger.String("orderId", id.String()))
}
// matching symbol only if provided
symbolMatches := symbol == "" || order.Symbol == symbol
if order != nil && symbolMatches {
uid, err := s.CancelOrder(ctx, CancelOrderInput{
Id: id,
IsClientOId: false,
UserId: userId,
}) //, symbol)
if err != nil {
logctx.Error(ctx, "could not cancel order", logger.Error(err), logger.String("orderId", uid.String()))
if order != nil {
// matching symbol only if provided
if symbol == "" || order.Symbol == symbol {
uid, err := s.CancelOrder(ctx, CancelOrderInput{
Id: id,
IsClientOId: false,
UserId: userId,
}) //, symbol)
if err != nil {
logctx.Error(ctx, "could not cancel order", logger.Error(err), logger.String("orderId", uid.String()))
}
res = append(res, *uid)
}
res = append(res, *uid)
}
}

Expand Down

0 comments on commit af71d1c

Please sign in to comment.