Hyperliquid

Hyperliquid lets traders revise resting orders while completed fills remain recorded

Hyperliquid supports price and size changes to resting orders and cancellation of their unfilled remainder. Those controls affect instructions that can still execute. They cannot rewrite a completed fill or restore the account to its earlier state. Before changing an order, establish whether it remains open, has partially filled or has already finished.

- last updated

An edit also has execution conditions of its own. A replacement can fail validation, and a cancellation request can arrive after a fill. The relevant boundary is the order’s recorded state when the action takes effect.

Price and size edits create replacement instructions

The modify action identifies an existing order and supplies replacement details, including price and size. Its placement conditions matter when the original order changes state during submission.

Replacement placement conditions

The API’s optional always_place flag allows the replacement to enter even when cancellation fails. Without that behavior, the replacement must be non-trigger and either post-only or a good-til-canceled order that cannot execute immediately. The latter becomes post-only.

Price increments and available margin

A replacement price must respect the market’s tick size, and its quantity must respect the lot size. These increments define valid prices and quantities. Perpetual orders also face margin checks when entering the book and again when a resting order matches. Increasing size can introduce a margin problem that the original order did not have. Orders match by price-time priority; an intended price improvement does not establish that a trade occurred.

A partial fill separates completed trades from cancellable quantity

Once part of an order executes, that quantity belongs to the account’s trading history. Cancellation concerns the remaining instruction. Reducing the unfilled quantity cannot reduce an already established position, and raising the limit price cannot revise earlier execution prices.

For a perpetual, opening fills increase exposure and contribute to the displayed average entry price. Closing trades reduce exposure without recalculating that entry price. Spot accounting instead follows asset balances and trades. An opposite trade changes the resulting account state through another execution; it does not erase the original transaction. This distinction explains why canceling an entry order can leave a position or an acquired asset balance behind.

A partial fill separates completed trades from cancellable quantity: Once part of an order executes, that quantity belongs to the account’s trading history.; Cancellation concerns the remaining instruction.; Reducing the unfilled quantity cannot reduce an already established position, and raising the limit price cannot revise earlier execution prices.

View image file

Time-in-force determines whether an unfilled remainder stays available

The order’s time-in-force determines whether unmatched quantity remains on the book. A cancellation opportunity exists only while a cancellable instruction remains.

Good-til-canceled orders

A good-til-canceled order can rest until execution or cancellation. Its displayed quantity can change through partial fills before an edit reaches the matching engine. The original submitted size therefore cannot establish how much remains available to change.

Immediate-or-cancel orders

An immediate-or-cancel order cancels any quantity that does not execute immediately. There is no resting remainder to revise after that processing finishes. A partly executed order can consequently leave both a fill record and canceled quantity.

Post-only orders

A post-only order enters as resting liquidity and cannot immediately trade against the opposing book. That condition also matters when the modification rules require a post-only replacement. The engine rejects a post-only order whose price would immediately match.

Rejections and missing-order errors require different responses

A missing-order cancellation error does not identify one unique outcome. The order might never have entered, might already have been canceled or might have filled. Repeating the cancellation cannot distinguish those possibilities.

Other errors identify a specific problem with the instruction. Invalid price increments, insufficient margin and insufficient spot balance require different corrections. A reduce-only rejection means the proposed order would increase the position. Treating each error as a temporary connection problem can lead to repeated invalid submissions. The error describes why an action failed; the order and account records establish what remains afterward.

An unsuccessful edit is not evidence that the desired replacement now exists.

Rejections and missing-order errors require different responses: Other errors identify a specific problem with the instruction. Invalid price increments, insufficient margin and insufficient spot balance require different corrections. A reduce-only rejection means the proposed order would increase the position.; Treating each error as a temporary connection problem can lead to repeated invalid submissions. The error describes why an action failed; the order and account records establish what remains afterward.

View image file

Canceling a remainder requires an open order and a separate fill check

Suppose a resting entry order may have partially filled, and the remaining entry is no longer wanted. If the order has already finished, there is no open remainder to cancel. Establish its status before deciding whether cancellation is still the relevant action. If the partially filled entry has attached take-profit or stop-loss orders, manually canceling the parent also cancels those child orders. To retain TP/SL coverage for the resulting position, place separate position TP/SL orders.

  • Confirm the account and order identifier before targeting a cancellation.
  • If the order remains open, cancel the unwanted remainder and inspect the individual response.
  • Expect a successful cancellation to remove that remainder from open orders.
  • Compare the observed status with the fill records, including executions that occurred before cancellation.
  • If the order has fills, inspect the resulting position or asset balance before choosing any separate exit trade.

The expected result is no further execution from the canceled remainder. A remaining position does not contradict that result: earlier fills can explain it. Conversely, disappearance from open orders alone cannot prove cancellation, because a completed fill also removes an order. The status and fill records distinguish those outcomes.

Canceling a remainder requires an open order and a separate fill check: The expected result is no further execution from the canceled remainder. A remaining position does not contradict that result: earlier fills can explain it.; Conversely, disappearance from open orders alone cannot prove cancellation, because a completed fill also removes an order. The status and fill records distinguish those outcomes.

View image file

Order records and account records answer different questions

An order status describes the instruction; a fill records an execution. Useful fill details include the order identifier, trade identifier, quantity, price and timestamp. These details connect an execution to the instruction that produced it. Retaining them also avoids relying on a transient confirmation message.

Live applications can receive order updates separately from fill updates. Fill streams begin with a snapshot and then deliver subsequent events, so a newly received record is not necessarily a newly executed trade. Reconciliation needs to distinguish that snapshot from fresh activity.

For perpetuals, the account summary supplies positions and margin information. Funding history and other ledger updates explain additional balance changes. Trading fees and funding payments can therefore remain relevant after cancellation, particularly when earlier fills left exposure open. They do not mean that the canceled remainder traded again.

Closing exposure requires execution beyond order cancellation

A reduce-only order can reduce an existing perpetual position without opening exposure in the opposite direction. Its usefulness depends on execution: a resting exit order leaves the position open until it fills.

For an acquired spot asset, a later sale is another trade with its own execution conditions. Neither route rewrites the earlier fill. Changing a price, receiving a cancellation acknowledgment or submitting an exit does not prove that exposure decreased. The practical endpoint is the resulting position size or asset balance, together with the fills that explain the change.

Hyperliquid FAQ

Can Hyperliquid cancel open orders automatically if a trading connection fails?

The API provides a scheduled cancel-all action, commonly called a dead man’s switch. A trading client must set a future cancellation deadline through a signed action and keep rescheduling it while connected. If updates stop, the last accepted deadline determines when cancellation occurs. Scheduling has a minimum lead time and a daily trigger limit; a lost connection alone does not confirm cancellation. The scheduled operation targets open orders and does not close positions created by earlier fills.

Does canceling a TWAP remove its earlier executions?

Canceling a time-weighted average price order stops its remaining execution program without undoing completed slices. The API has a dedicated TWAP cancellation action that identifies the program. Earlier slice fills still matter when reconciling the account’s exposure.

Why can a batch cancellation return a single error?

Some failures apply to the entire request during pre-validation, so the API can return one error for the batch. Other order and cancellation errors ordinarily correspond to individual entries. Software must handle both response shapes instead of assuming that each requested cancellation always receives its own result.

Which price determines whether a take-profit or stop-loss instruction has triggered?

The mark price triggers take-profit and stop-loss orders. A different price displayed in the trading interface therefore cannot establish whether the trigger condition has occurred. Once triggered, the instruction’s execution conditions still govern its outcome; triggering alone does not establish a completed exit.

Will a recent-history query contain every order that was canceled?

A recent-history query is bounded and should not be treated as a complete account archive. Older records can fall outside the returned results. Keep relevant order identifiers, responses and fill records when durable reconciliation matters, rather than interpreting absence from one recent-history response as proof that an order never existed.