Order Types
HyperLiquid supports the following order types:Two additional internal order types exist:
CloseForVaultWithdrawal (used when vaults process withdrawals) and SpotDustConversion (converts small residual spot balances).Time-in-Force
Every order carries a time-in-force (TIF) setting that determines its lifecycle:BookOrder Structure
Each resting order on the book contains:OrderCore holds the shared core fields (price, side, asset) that are common across all order types.
Trigger Orders (TP/SL)
Trigger orders sit in a separateuntriggered_orders pool until their trigger condition is met.
triggerPx, the trigger fires and the order enters the active book as its underlying type (market or limit).
Position-level TP/SL orders (isPositionTpsl: true) are tied to the position itself rather than being standalone orders. They automatically cancel if the position is closed by other means.
Order Relationships
Orders can be linked through parent, sibling, and child relationships via therelationships field on BookOrder.
One-Cancels-Other (OCO)
Sibling relationships implement OCO behavior. When one sibling order fills, all other siblings are automatically cancelled with reasonsiblingFilledCanceled.
A common pattern: a take-profit limit and a stop-loss market order are placed as siblings. Whichever triggers first cancels the other.
Cancel and Rejection Taxonomy
HyperLiquid distinguishes between cancellations (order was on the book and removed) and rejections (order never made it onto the book).User-Initiated Cancellations
System-Enforced Cancellations
Order Rejections
Order Book State
The exchange maintains order book state within each perp DEX:
These outputs are available through the streaming API for real-time order book reconstruction.
TWAP Engine
HyperLiquid includes a native TWAP (Time-Weighted Average Price) engine for executing large orders over time. TWAP is used both by users directly (twapOrder/twapCancel actions) and internally by the liquidation system.
TWAP State
Execution
Each TWAP order is split into time-weighted slices. TheWindowUpdate tracks progress:
Constraints
TWAP orders produce
node_twap_statuses in each block’s execution data, and fills appear as UserTwapSliceFills in the indexer.
TWAP is also used by the BOLE lending system for liquidations, where large positions are unwound gradually to minimize market impact. See Lending and Liquidation for details.