Amending Orders¶
Objective¶
Learn to modify resting orders — change price, quantity, or both — and understand how amendments affect queue priority.
Prerequisites¶
- Exchange running with two-sided liquidity from previous chapters
(manual MM gateways or
pm-mm-bot). TRADER01connected with at least one resting limit order.
Exercise 1: Place a Resting Order to Amend¶
Note the order_id returned.
Checkpoint: order resting; ORDERS confirms qty=300, price=419.50.
Exercise 2: Amend Quantity Down¶
Reduce the order to 200 shares:
Expected: amendment accepted; new qty=200.
Priority preserved
Reducing quantity does not lose time priority — your order keeps its place in the queue.
Why: you are not jumping ahead of anyone; you are only reducing your own claim at the same price level.
Checkpoint: ORDERS shows qty=200, same price.
Exercise 3: Amend Price¶
Move the order to a more aggressive price:
Expected: amendment accepted; new price=419.70.
Priority lost
A price change always loses time priority — the order moves to the back of the queue at the new price level.
Why: a new price is treated as a new offer, so queue fairness requires re-entering at the back.
Checkpoint: ORDERS shows price=419.70.
Exercise 4: Amend Both Price and Quantity¶
Checkpoint: both fields updated in one command.
Exercise 5: Attempt an Invalid Amendment¶
Try setting quantity to zero:
Expected: rejection — quantity must be positive.
Try amending a non-existent order:
Expected: rejection — order not found.
Checkpoint: both invalid amendments rejected with clear errors.
Exercise 6: Amend After Partial Fill¶
-
Place a large buy:
(This may immediately fill partially against the MM ask.) -
If partially filled, amend the remaining quantity:
Note
The new qty must be ≥ already-filled quantity. You cannot amend below what has already been executed.
Checkpoint: amendment accepted on partially filled order.
Key Rules¶
| Change | Priority Impact |
|---|---|
| Quantity down | Priority preserved |
| Quantity up | Priority lost |
| Price change (any direction) | Priority lost |
| Both price and qty | Priority lost |
Reflection¶
Why does reducing quantity preserve time priority, but increasing it does not? What unfair advantage would a trader gain if increasing quantity kept their original priority in a busy book?