Portal pentru dezvoltatori
Temă

Order Amendment, Cancellation, and Order Rules#

Order Amendment Behavior#

Users can locate and amend an existing order by Order ID (oid) or Client Order ID (clientOrderId).

  • oid and clientOrderId are used only to identify the target order; provide one of them.
  • Neither oid nor clientOrderId can be changed through an amendment.
  • If an amendment includes orderType, the complete corresponding substructure must be provided. Partial updates to internal fields are not supported.
  • Omitting orderType means that the order type and trigger parameters are unchanged.

Amendment Scope and Restrictions#

Standard Limit Orders#

  • Only price and size can be amended.
  • Cannot be converted to Trigger or TPSL orders.
  • tif and expiresAfter cannot be amended.

Standalone Trigger Orders#

Order TypeAmendable FieldsPermitted Type Switches
Trigger MarketTrigger Price, Order Amount, Trigger Price TypeMay switch to Trigger Limit; a valid Order Price is required.
Trigger LimitTrigger Price, Order Price, Order Amount, Trigger Price TypeMay switch to Trigger Market; the post-trigger limit price is no longer used.

Trigger Price Type may be switched between Index Price and Mark Price.

Order-Attached TPSL#

Before Child-Order Activation#

Child Order TypeAmendable FieldsPermitted Type Switches
TP or SL Trigger MarketTrigger PriceTP may switch among TP Limit, TP Trigger Market, and TP Trigger Limit. SL may switch between SL Trigger Market and SL Trigger Limit.
TP or SL Trigger LimitTrigger Price, Order PriceSame as above.
TP LimitOrder PriceTP may switch to TP Trigger Market or TP Trigger Limit.
  • Trigger Price Type may be switched between Index Price and Mark Price for trigger orders.
  • Before activation, identify the TPSL child order with its TPSL child oid.

After Child-Order Activation#

Child Order TypeAmendable FieldsPermitted Type Switches
TP or SL Trigger MarketTrigger Price, Order AmountTP Trigger Market and TP Trigger Limit may switch between each other. SL Trigger Market and SL Trigger Limit may switch between each other.
TP or SL Trigger LimitTrigger Price, Order Price, Order AmountSame as above.
TP LimitOrder Price, Order AmountType switching is not supported.
  • After conversion to a live order, identify the order using the live order's oid.
  • Trigger Price Type may be switched between Index Price and Mark Price for trigger orders.

Position-Attached TPSL#

Entire Position#

Entire Position TPSL applies to the full remaining quantity of a specified position. When triggered, it closes the actual remaining position at that time; therefore, Order Amount cannot be specified or amended.

  • Only Trigger Market is supported.
  • Trigger Price can be amended.
  • Trigger Price Type may be switched between Index Price and Mark Price.
  • Order Amount cannot be amended.
  • Switching to Trigger Limit or TP Limit is not supported.

Partial Position#

Order TypeAmendable FieldsPermitted Type Switches
Trigger MarketTrigger Price, Order AmountMay switch to Trigger Limit.
Trigger LimitTrigger Price, Order Price, Order AmountMay switch to Trigger Market.
TP LimitOrder Price, Order AmountType switching is not supported.
  • Position TP Limit is immediately converted to a live Reduce-Only GTC Limit order.
  • Amend a Position TP Limit using the live order oid in children[0].
  • Whether Trigger Price Type can switch between Index Price and Mark Price for Partial Position Trigger orders is not defined and must be confirmed by trading and on-chain engineering.

Non-Amendable Fields#

The following fields cannot be changed through an amendment:

  • assetId
  • side
  • marketType, including marginMode and positionSide
  • reduceOnly
  • sizeType
  • tif
  • expiresAfter
  • clientOrderId
  • grouping

To change any of these business attributes, cancel the order and submit a new order.

Other Amendment Restrictions#

  • Trigger orders cannot be amended in Prediction Market.
  • IOC and FOK orders do not remain on the order book and therefore cannot be amended.

Validation and Matching Priority#

Amended ParameterScenarioRevalidation RequiredRe-enters Matching PriorityRule
PriceChanged to a different order priceYes. Order limits, price or position value, frozen margin, and leverage-based position-value checks may apply.YesRegardless of whether the price increases or decreases, the order moves to the end of the new price-level queue.
SizeIncreasedYes. Additional frozen margin may be required.YesThe entire amended order is treated as a new order and moves to the end of the current price-level queue.
SizeDecreasedYes. Applicable order-limit checks still apply.NoThe original queue priority is retained.

Filled-Size Inheritance and Amendment Failure#

  • A successfully amended order inherits the original order's cumulative filled size.
  • Semantically, a successful amendment cancels the original order and creates the amended order.
  • Example: orderSize=10, accFillSz=4. After increasing the size to orderSize=15, the result is orderSize=15, accFillSz=4.
  • If the new size is less than or equal to accFillSz, the effective order size is set to accFillSz, leaving zero remaining quantity. The order status becomes part_filled_canceled.
  • If validation fails, the original order remains unchanged and is not cancelled first.

Reduce-Only Order Amendment and Cancellation Logic#

Reduce-Only is an order attribute. When reduceOnly=true, an order may only reduce an existing position; it cannot increase a position or open a position in the opposite direction.

  • Standard Limit and standalone Trigger orders support reduceOnly=true.
  • The execution order created when a Trigger order fires must continue to comply with Reduce-Only restrictions.
  • Position-Attached TPSL can only reduce its corresponding position.
  • Order-Attached TPSL applies only to Market, Limit, or Trigger parent orders with reduceOnly=false.
  • A parent order with reduceOnly=true must not include Order-Attached TPSL. The request must be rejected as a whole and must not be automatically converted to Position-Attached TPSL.
  • Multiple Reduce-Only orders may coexist for the same position.

Placement and Amendment Validation#

  • A corresponding position must exist.
  • The order side must be opposite to the position side.
  • New-position margin validation is not performed, but the order must still pass general account-status, instrument-status, price, size, precision, and order-count checks.
  • The reduceOnly attribute cannot be changed through an amendment. Cancel and resubmit the order to change it.
  • Price amendments and size increases or decreases continue to follow the standard matching-priority rules.

Excess-Size Trimming Rules#

  1. The system calculates the aggregate remaining size of Reduce-Only orders by account, assetId + marginMode + side.
  2. In Hedge mode, long and short positions are calculated separately, and side must correspond to the positionSide being reduced.
  3. Orders remain unchanged if their aggregate remaining size does not exceed the corresponding position size.
  4. After placement or amendment, if aggregate remaining size exceeds the position size, the system trims orders according to FIFO by orderCreateTime, from oldest to newest:
    1. Reduce the oldest existing Reduce-Only orders first.
    2. Cancel an order if its remaining size is less than or equal to the amount that must be trimmed.
    3. Otherwise, reduce only the required amount from that order.
    4. Continue until aggregate remaining size no longer exceeds the position size.
  5. The same excess check and FIFO trimming are performed when fills, liquidation, ADL, settlement, or other events reduce the position.
  6. Trimming affects only the quantity exceeding the position size and must never result in a reverse position.

Transaction Execution Order and Nonce Invalidation#

  1. Transactions enter a block in the order received by the Sequencer. Within the same block, execution priority is:

    1. Noop
    2. Post-Only placement or amendment to Post-Only
    3. Cancellation
    4. All other operations
  2. Transactions with the same priority retain their original Sequencer receipt order.

  3. A Noop cannot be replayed across blocks and cannot invalidate an action that has completed or whose nonce has already been consumed.