Hyperliquid

Hyperliquid: Order Changes, Cancellations, and Completed Fills

Hyperliquid lets you request changes to an open order’s price or size and cancel its unfilled remainder. Completed fills stay in your trading history; changing the exposure they created requires another trade. The available action depends on whether the order still rests, has partly filled, or has finished. Trigger orders add another distinction: changing when an exit activates doesn’t change a trade already executed. A submitted edit needs confirmation before you can rely on its replacement terms.

What's inside
The short version: Canceling an order stops its remaining quantity from trading only after cancellation succeeds; any completed fills remain in the account.

Changing an order, canceling it, or closing exposure

An order modification changes an outstanding trading instruction, cancellation removes unfinished quantity, and a closing trade reduces an existing position. Choose the operation by what remains outstanding. An unfilled entry has no resulting position to close. A partially filled entry can leave both a position and an open remainder, so it presents separate decisions.

A replacement limit order still controls acceptable execution prices. A closing market order seeks available liquidity immediately, while a closing limit order can remain unfilled. Reduce-only constrains a perpetual order to reducing exposure rather than opening the opposite position.

The connection between an open order and available margin

The order book holds trading instructions, while the clearinghouse handles perpetual positions and margin checks. Editing a displayed order doesn’t bypass those checks. HyperCore checks margin when opening an order and again when a resting order matches, so earlier acceptance doesn’t guarantee later execution.

That relationship matters when an edit increases quantity or when other account activity changes available collateral. A resting order can encounter different margin conditions by the time a counterparty reaches it. The book also matches orders by price-time priority. A preferred price therefore doesn’t promise immediate execution: compatible opposing liquidity must reach the order under the matching rules.

Valid replacement prices and quantities

Replacement values must fit the selected market’s price and size precision. A decimal value that looks reasonable on screen can still fail validation. Price precision depends on both significant figures and the asset’s size precision; spot and perpetual markets use different decimal limits.

Quantity has its own permitted decimal precision. An edit should preserve the intended price boundary and remaining quantity while satisfying those rules. Rounding a buy price upward or a sell price downward changes the execution you’re willing to accept. Rounding quantity upward likewise changes the amount you’re asking to trade. Precision handling is therefore part of the order instruction, rather than a cosmetic display choice.

Partial fills and the amount still outstanding

A partial fill leaves executed quantity separate from whatever remains open. Changing the outstanding instruction doesn’t rewrite earlier execution prices or remove the position those fills created. If you still want the same total purchase or sale, the quantity already executed belongs in that calculation.

The additional quantity needed equals the intended total minus completed fills. Apply it to actual execution records, including fills that arrived while the edit was pending. An interface’s original quantity and remaining quantity describe different things; neither should substitute for the other without checking the field’s meaning.

Order records expose original size alongside order status and size information, while fill records identify executed quantities and prices. Together, they distinguish an unfinished instruction from trading already completed.

Can an order fill while cancellation is pending?

An order can fill before its cancellation takes effect, so pressing cancel doesn’t freeze the displayed quantity. A cancellation request can encounter an order that has already filled or already disappeared through another cancellation.

A missing-order response alone doesn’t distinguish those outcomes. Retrying a new entry immediately can add exposure if the first order completed. Read the recorded outcome before treating an unsuccessful cancellation as permission to submit another trade. Cancellation can stop outstanding quantity, but it can’t reverse execution.

A replacement limit order with a fill during the change

Consider a hypothetical unfilled perpetual buy order and a proposed lower replacement price. Assume sufficient margin, valid price and size precision, a replacement that meets the minimum order value, and a price that won’t immediately match. The intended final quantity is Q, and the account initially has no position in this market. These assumptions describe the example, not a live market.

The trader submits a non-trigger, post-only modification for quantity Q at the lower price. The accepted replacement appears with the intended price and quantity. A separate check of open orders and execution history confirms that the new instruction rests and no entry fill occurred. The position remains empty because acceptance alone didn’t execute a purchase.

If the original order instead fills quantity F before the change takes effect, the account holds a long position of F. If the trader still intends a total quantity Q, the additional amount needed is Q minus F, subject to valid precision and order requirements. Reusing Q as a fresh outstanding amount could exceed the intended total.

A replacement limit order with a fill during the change: Consider a hypothetical unfilled perpetual buy order and a proposed lower replacement price.; Assume sufficient margin, valid price and size precision, a replacement that meets the minimum order value, and a price that won’t immediately match.; The intended final quantity is Q, and the account initially has no position in this market. These assumptions describe the example, not a live market.

Open full-size image

The trader compares the modification response with the replacement’s recorded status, intervening fills, and resulting position. An accepted resting replacement establishes what can trade next; the execution history establishes what already traded. If the original fills completely, reducing that exposure requires a separate closing trade. Repeating the old edit can’t restore the initial account state.

Stop changes and the position they cover

Take-profit and stop-loss changes alter future exit instructions, including their trigger conditions and covered quantity. Hyperliquid uses the mark price to trigger these orders. A trigger price determines activation; a limit price constrains execution after activation.

A triggered limit exit can remain unfilled when available prices fall outside its boundary. Moving the trigger doesn’t remove that execution constraint.

Position-level exits can attempt to close the entire position at trigger time. An explicitly configured size stays fixed instead of resizing with subsequent position changes. That distinction matters after partial closes or additional entries.

Manually canceling a partially filled parent order also cancels its attached take-profit and stop-loss orders. Protecting the remaining position then requires separate exits. Cancellation for insufficient margin follows a different rule: after a partial fill, it places the attached exits as though the parent had fully filled; their trigger conditions still determine activation.

API modification and unconditional replacement

The API’s modification behavior depends on its replacement settings. With always_place enabled, it places the new order regardless of whether cancellation succeeded. That can create additional exposure when the old order has already filled.

Without that behavior, the replacement must be a non-trigger order using ALO, or a non-executable GTC order; the latter becomes ALO. Clients must omit the flag when false. These constraints make compatibility between the requested replacement and modification mode material. A client shouldn’t silently enable unconditional placement merely to get an otherwise incompatible edit accepted.

Separate cancellation and new placement also require separate outcome handling. A failed cancellation doesn’t establish a safe starting state for a replacement.

Resting, post-only, and immediate replacement instructions

Time-in-force determines what a newly submitted limit instruction does when it reaches the book. Good til canceled, or GTC, permits an unfilled remainder to rest. Immediate or cancel, or IOC, removes whatever cannot execute immediately. Add liquidity only, or ALO, prevents immediate matching and cancels an order that would take liquidity.

Post-only behavior therefore affects whether a repriced order can survive its arrival at the book. A price that crosses opposing liquidity conflicts with that condition. An IOC instruction has a different outcome: it can execute available quantity and cancel the rest, leaving nothing open to edit. Neither behavior establishes that the full requested amount traded.

Resting, post-only, and immediate replacement instructions: Time-in-force determines what a newly submitted limit instruction does when it reaches the book.; Good til canceled, or GTC, permits an unfilled remainder to rest. Immediate or cancel, or IOC, removes whatever cannot execute immediately.; Add liquidity only, or ALO, prevents immediate matching and cancels an order that would take liquidity.

Open full-size image

Margin adjustments after execution

Margin adjustments change collateral supporting a position without changing its executed quantity. Isolated positions support adding margin, while removal depends on the applicable rules; strict isolated markets prohibit discretionary margin removal. A leverage-setting change likewise doesn’t undo an entry. Closing quantity requires execution in the reducing direction, and changes to collateral must still satisfy the account’s margin requirements.

Closing fills and the remaining account balance

A closing order changes exposure only to the extent it executes. Its completed fills have their own prices and trading charges, so returning position size to zero doesn’t necessarily restore the balance held before entry. Spot and perpetual trades use separate fee schedules, with applicable rates depending on the account and market.

Closing fills and the remaining account balance: A closing order changes exposure only to the extent it executes.; Its completed fills have their own prices and trading charges, so returning position size to zero doesn’t necessarily restore the balance held before entry.; Spot and perpetual trades use separate fee schedules, with applicable rates depending on the account and market.
Visual summary: Closing fills and the remaining account balance.

Open full-size image

Perpetual funding can also change the balance while a position remains open. Canceling an outstanding entry or exit doesn’t stop funding on exposure the account still holds. Funding rates concern that continuing position, rather than the canceled instruction. Once closing execution removes the position, the remaining task is to account for completed trades and accrued balance changes. If a residual position remains, another cancellation won’t close it.

Hyperliquid FAQ

Why does dragging my stop order to a new price fail?

Dragging a take-profit or stop-loss order to a level that would immediately execute it produces an error. The chart control prevents that change; an immediate exit requires a separate closing action through the position controls or order form. Moving a trigger and requesting an immediate close have different effects.

Does closing the browser cancel an open limit order?

Closing the browser doesn’t cancel a resting GTC order. Its lifetime follows its order conditions and exchange state, rather than the browser session. A deliberate cancellation needs a confirmed outcome; disconnecting the interface doesn’t supply one.

How should software interpret an error returned for a batch of changes?

Software must handle both individual action errors and a single validation error covering the entire batch. Order and cancellation responses usually correspond to submitted actions, but some invalid payloads fail before individual processing. A successful network response alone doesn’t establish that every requested change succeeded.

When can a reduce-only order disappear without filling?

A reduce-only order can be canceled when it would no longer reduce the position. The recorded status can identify that reason separately from a fill or manual cancellation. This matters when other trading changes the position an outstanding exit was intended to reduce.

Which identifier can an API client use to target an order modification?

An API modification can target an exchange order ID or a client order ID. The identifier must refer to the intended order, and the request still needs compatible replacement parameters. Identifying the order doesn’t establish that it remains open.

Can reconnecting an execution feed make old fills look new?

A WebSocket subscription can deliver a snapshot containing earlier fills when it connects. Snapshot messages carry an explicit snapshot indicator. Software should avoid counting previously processed executions again, or it can incorrectly calculate how much quantity remains after an edit.

· updated