EngineOrders & Positions

Modifying and cancelling

Understand operation-specific matching and verify the resulting order state.

Use an existing order snapshot when modifying or cancelling. Confirm the selected runtime supports the operation, and inspect the order state again afterward.

Shared simulator matching

The generic shared modifyOrder and cancelOrder paths locate an order by matching its instrument, action, and quantity. They do not select solely by the supplied ID.

Modification replaces the matching order object. If you change quantity in the object you submit, it may no longer match the original order. Preserve the original identity fields and do not describe this API as a universal patch-by-ID operation.

Cancellation removes the first matching order. When several indistinguishable orders exist, this matching rule matters; do not assume the ID uniquely controls which order is selected.

Return values differ from placement

Shared modify/cancel methods can complete without returning a value. The placement example's “not false, undefined, or null” acceptance test is therefore unsuitable for deciding whether these operations succeeded.

Check the updated order snapshot and logs. For broker-backed paths, also wait for the appropriate broker state update rather than treating request dispatch as final cancellation.

Cancellation does not close exposure

Cancelling an unfilled instruction does not close an already filled position. If the order fills while cancellation is in progress, inspect the resulting position before deciding on another action.

cancelAllOrders applies to the orders owned by the chosen session implementation. Verify that scope rather than assuming account-wide cancellation across every app.

Cancel and replace deliberately

Do not submit a replacement solely because a cancel request returned. Establish the old order's outcome, then use fresh execution state to size and submit the replacement. Modification and cancellation still pass their applicable execution controls.

Broker-backed and shared simulated paths have separate implementations. Verify modification support and behavior for your selected broker before relying on it.

Continue with positions.

On this page