NOONOO TRADINGStart in the bot

Amending an Order vs Cancel-and-Replace: Which Loses Queue Priority?

After placing a limit order, you may want to move its price slightly or change its quantity. You have two options: amend the values while keeping the order active, or cancel the existing order and submit a replacement. The screen may show the same final result, but what happens in between is very different.

The difference between the two methods

An amendment requests a change while retaining the order ID. Cancel-and-replace removes the old order and submits another under a new order ID, using two requests.

Same goal, different path

Goal: raise a limit buy of 3 contracts
from $59,800 → $59,850

1. Amend
1 request
Order ID: unchanged
Time without an order in the market: none

2. Cancel and replace
2 requests: cancel → submit
Order ID: newly issued
Between the requests: no order

─────────────
Where the differences arise:
queue position, unprotected interval and request count

Some exchanges have no amendment API. In that case, cancel-and-replace is the only option, so your design must account for the unprotected interval described below.

When is queue priority preserved?

Orders at the same price fill in arrival order. Amending does not always preserve that position. It depends on what you change.

Queue treatment by amendment type

Current $59,800 buy queue: 12 contracts ahead of you

Change price: $59,800 → $59,850
→ Join the back of another price queue
→ Priority lost, naturally

Increase quantity: 3 → 5 contracts
→ Usually move to the back
→ Priority lost

Reduce quantity: 3 → 2 contracts
→ Priority retained

─────────────
Why?
Increasing quantity would cut in line.
Reducing it does not disadvantage others.

Increasing quantity by amendment therefore often has essentially the same result as cancel-and-replace. To keep existing priority while increasing size, leave the old order in place and add a separate order for the extra amount. Instead of changing 3 contracts to 5, add another order for 2. See execution priority and order queue priority for how queues are arranged.

The unprotected interval in cancel-and-replace

This is the most practical risk. From the moment cancellation is processed until the replacement is accepted, there is an interval with no order of yours in the market.

Moving a stop in 0.4 seconds

Position: long 3 contracts, average entry $60,000
Resting stop-limit sell: $59,500

You decide to raise the stop to $59,600.

t+0.00: send cancellation request
t+0.18: cancellation completed ← no stop
t+0.22: send new order request
t+0.41: replacement accepted

Unprotected interval: 0.23 seconds

─────────────
Usually nothing happens.
If a sharp falling candle overlaps this interval:
→ Price passes without a stop.
→ The replacement is placed at a price already passed.

In normal conditions, 0.23 seconds may seem negligible. But the moment you want to move a stop is often when price is moving fast, exactly when the gap matters. Where an amendment API is available, it avoids that gap, so prefer amending exit orders to canceling and replacing them. The time involved in a request's round trip is explained in order latency.

Why reversing the sequence can be dangerous

If you dislike the unprotected interval and place the new order before canceling the old one, there are briefly two orders.

Submit first, cancel later

t+0.00: new $59,600 stop accepted
t+0.20: request cancellation of old $59,500 stop

t+0.00–t+0.20: 2 stops
Total: 6 contracts against a position of 3

If price plunges during this interval:
→ Both orders fill.
→ 3 contracts close the position; 3 create an opposite position.

─────────────
With reduce-only:
the excess is ignored, providing protection.
Without it:
an unintended short appears.

If you use that sequence, reduce-only is essential on exit orders. See post-only, reduce-only and IOC for the options. Also, if your account's orders cross each other, self-trade prevention may trigger and quietly cancel one of them.

Amending a partially filled order

When an order has already partly filled, consider the remaining quantity rather than only the original size. Confusing the calculation can leave a larger or smaller order than intended.

Count the remaining quantity

Original order: buy 5 contracts at $59,800
Already filled: 2 contracts
Remaining: 3 contracts

You request: 'Amend quantity to 4 contracts.'

Interpretation A: total order is 4 → 2 remain
Interpretation B: remaining quantity is 4 → total becomes 6

─────────────
Exchanges interpret this differently.
Without checking, you can leave
half or 1.5 times the intended amount.

Safer approach:
query the remaining quantity before calculating the amendment.

An amendment below the already filled quantity is usually rejected or treated as immediate cancellation. In the example, 'amend to 2 contracts' leaves zero remaining because 2 have already filled, so the order disappears. See partial fills for how remaining quantities persist.

Request counts and rate limits

Cancel-and-replace doubles the request count. A few manual adjustments may not matter, but a bot that continually follows price can rapidly consume its allowance.

One adjustment per second for one minute

Amendment:
60 seconds × 1 request = 60 requests

Cancel-and-replace:
60 seconds × 2 requests = 120 requests

With an order query as well:
60 seconds × 3 requests = 180 requests

─────────────
At the limit:
the next request is rejected.
That request may be a stop-loss order.

See API rate limits for limit-exceeded responses and handling. In practice, requiring price to move by a minimum distance before adjusting reduces requests. Following every 1-tick movement increases requests while repeatedly sacrificing queue priority.

When you do not receive a response

The hardest cancel-and-replace case is a lost response in the middle. If you submit a new order without knowing whether cancellation succeeded, there are two possible outcomes.

Two branches after a lost response

Cancellation request sent → no response

Branch A: cancellation succeeded
→ Submit replacement → 1 order, as intended

Branch B: cancellation failed
→ Submit replacement → 2 orders

─────────────
Retrying without checking can
double the outstanding contract quantity.

Sequence:
1. Query the order list again.
2. Confirm the actual state.
3. Only then submit.

See duplicate orders and idempotency for safeguards against duplicate submission. Assigning a client order ID can allow the exchange to recognize a retry as the same request and prevent it from being accepted twice.

Which method should you use?

Selection criteria

Use amendment:
when moving an exit or stop-loss order;
when reducing quantity and retaining priority;
for bots that adjust frequently.

Use cancel-and-replace:
when there is no amendment API;
when changing the order type itself,
such as limit → conditional;
when changing options such as post-only.

Use neither:
when increasing quantity.
→ Add the extra amount as a separate order.

Changing an order's type or options usually cannot be done through amendment. Converting a limit order to a conditional order or adding post-only requires a new submission. In that situation, account for the unprotected interval. For exit orders, a better sequence may be to submit the reduce-only replacement first, then cancel the old order. Switching to a structurally different order such as a stop-limit or OCO order falls into this category.

Summary

1. Amendment uses 1 request; cancel-and-replace uses 2.
2. Amendment preserves the order ID.
3. Changing price loses queue priority either way.
4. Increasing quantity loses priority.
5. Reducing quantity preserves priority.
6. To increase size, add a separate order.
7. Cancel-and-replace creates an unprotected interval.
8. That interval can coincide with fast markets.
9. Reversing the sequence briefly creates 2 orders.
10. Reduce-only is the safeguard in that case.
11. During partial fills, account for remaining quantity.
12. Double the requests means double the rate-limit use.
13. After a lost response, query again before submitting.

Amendment aims to preserve an existing order's position; cancel-and-replace rebuilds the order explicitly. Whichever you use, prevent accidents by querying and confirming what actually remains after sending the request.

Caution

The quoted prices, such as $59,500, $59,600, $59,800, $59,850 and $60,000; quantities such as 3, 5 and 12 contracts; times such as 0.18, 0.23 and 0.41 seconds; and calculations of 60, 120 or 180 requests for one adjustment per second are all hypothetical examples explaining rules. They are not actual order-book prices, measured response times or observations from a particular account. Amendment behavior varies by exchange. Check each exchange's API documentation for amendment availability, queue treatment when increasing or decreasing size, whether a partially filled order's amended quantity means total or remaining size, client-order-ID idempotency, and how rate limits are counted. This article explains execution rules and does not recommend a trading method or bot configuration. Leveraged trading can lose the entire principal, and accurate order management does not guarantee profits. You are responsible for investment decisions and their outcomes.

NOONOO TRADING invites you to follow live trading in our free chat.

Start in the bot

📈 OKX trading fee discount for new registrations

Register for the OKX Fee Discount →