Hyperliquid matches spot and perpetual orders on its layer 1 blockchain

Last updated -

Hyperliquid is a layer 1 blockchain that runs spot and perpetual trading through onchain order books. HyperCore handles order matching and trading accounts, while HyperEVM supports Ethereum-compatible smart contracts on the same chain. A completed trade changes a token balance or derivative position; an accepted order may remain open without completing the intended trade.

Execution depends on the selected instrument, order settings and the account's available collateral. Price limits define permitted execution prices, while liquidity and margin determine whether orders can fill.

Spot Balances and Derivative Exposure

Spot trading exchanges the selected token against the market's quote asset, which is the asset used to state prices. A spot purchase increases the purchased token balance. A perpetual trade changes a long or short position, with collateral supporting that exposure. These different account effects determine whether the intended action acquires tokens, opens exposure or closes an existing position.

Ordinary perpetual contracts have no scheduled expiration and use funding payments to help keep their prices near the underlying market. Their collateral asset and price denomination need separate attention. Validator-operated crypto contracts commonly use USDC collateral, while HIP-3 builder-deployed markets can use other collateral assets. A quoted price therefore does not establish which balance supports the position. Existing exposure also matters: a buy can reduce a short before it opens a long.

HIP-4 outcome contracts add bounded payouts and dated settlement through a fully collateralized design, without perpetual-style leverage.

Account Modes and Collateral Boundaries

Account mode determines which balances support a trade. Standard accounts separate spot balances and perpetual DEX balances, with cross margin confined to each DEX. Unified accounts combine an asset's spot balance with collateral for cross positions that use that asset. Portfolio margin pools eligible spot assets and cross-margin positions. It can automatically borrow supported assets against eligible collateral when a trading balance is insufficient, while idle borrowable assets earn interest. It also has eligibility requirements and borrowing caps. When borrowing limits bind, additional margin must come from the required settlement asset.

Cross margin shares collateral within its applicable pool; isolated margin confines collateral to the selected position. Some markets require isolated margin, and strict isolated markets prevent manual margin removal while the position remains open, releasing it proportionally as exposure closes. For the standard perpetual calculation, initial margin equals position size multiplied by mark price and divided by leverage. Market-specific limits and margin tiers constrain that setting. A lower leverage selection allocates more initial margin, while shared collateral exposes cross positions to changes elsewhere in the pool.

Hyperliquid: Account Modes and Collateral Boundaries - diagram

View full-size image

Order Books, Price Limits and Size

Order books contain available bids and offers, so execution depends on the opposite side's prices and quantities. HyperCore matches spot and perpetual orders using price-time priority. Better prices take precedence, followed by earlier orders at the same price. A limit buy sets the highest permitted execution price; a limit sell sets the lowest. Neither promises that enough eligible liquidity will exist.

Hyperliquid - Order Books, Price Limits and Size - diagram
Diagram: Order Books, Price Limits and Size

View full-size image

Good til canceled (GTC) orders can leave an unfilled remainder resting. Immediate or cancel (IOC) orders cancel their unfilled portion. Post-only orders cancel when they would immediately match, preserving their intended resting-order behavior. Market orders prioritize immediate execution subject to available liquidity and execution constraints. Prices and quantities must satisfy the selected market's precision rules. Perpetual margin checks also apply when orders enter the book and when resting orders match.

Reduce-only orders may execute only to reduce an existing position, without increasing or reversing it. Scheduled TWAP orders distribute execution over time, while trigger orders wait for a qualifying price condition.

A Limit Buy With Partial Execution

This hypothetical case starts with no position in the selected perpetual market and no other trades, transfers or liquidations. The intended purchase is 2.8 units of exposure, using a limit price called L. Assume the market permits these sizes and the order meets its minimum value requirement.

The account has enough eligible collateral when it submits a GTC limit buy. At matching, assume eligible sell orders provide only 1.8 units at L or below. The buy fills that quantity, creates a long position of 1.8 units and leaves 1.0 unit resting. Submitting 2.8 units has not created a position of that size.

Matching fill records against the order identifier confirms the executed quantity. The position record independently confirms the exposure, while the open-order record accounts for the remainder. Fees affect the collateral balance, so a position-size calculation alone cannot reconcile account equity.

If later price changes leave insufficient margin to fill the remainder, the order can be canceled. Under the same assumptions, the existing 1.8-unit position remains and the remaining 1.0 unit never executes. The limit price defines a price boundary; live liquidity and margin determine whether the purchase completes.

Accepted Orders, Fills and Account Records

Order responses distinguish rejection, resting acceptance and execution. A resting order identifier confirms placement, without establishing a fill. The API can also return an error inside a response whose outer status says success. Check each order's result inside the response. Fill records identify executed quantity, price and fees, and order history identifies cancellations or other terminal states. HyperBFT gives native trading actions one-block finality, which finalizes their recorded state. Finalizing an open order leaves it open until another eligible action changes that state.

Account reconciliation uses the records appropriate to the instrument and account mode. A perpetual position shows exposure, while balances and margin show the resources supporting it. Unified and portfolio-margin accounts use the spot balance view for their combined trading balances. Funding payments, transfers and other fills can change equity independently of one order. An order's disappearance from the open list therefore needs its history and fills to explain whether it executed or canceled.

Mark Prices and Liquidation Exposure

Mark price drives perpetual margin calculations, unrealized profit or loss and liquidation assessment. For validator-operated crypto markets, its calculation combines external price information with onchain book data. The last trade price alone cannot describe liquidation exposure. Changes in funding payments and other cross positions can move an estimated liquidation price even without a new trade in the selected market. For ordinary perpetual margin, insufficient maintenance margin can trigger forced closure through the book or a backstop takeover. Portfolio margin has its own account-wide requirements that include borrowings.

Auto-deleveraging can also close profitable opposing positions if an account or isolated position has negative value. That mechanism differs from a trader voluntarily exiting or reaching a personal stop price. Price controls govern an order's eligible execution; they do not freeze collateral value or eliminate liquidation exposure. Spot holdings purchased without borrowing lack perpetual maintenance-margin obligations, although borrowing within portfolio margin changes the account's risk.

Trading Fees and Position Carrying Costs

Trading fees depend on maker or taker execution, the applicable spot or perpetual schedule and the account's fee tier. Rolling trading volume determines tiers, while qualifying staking discounts and market settings can alter charges. HIP-3 deployer settings can affect the fee schedule. The fee recorded on a completed fill establishes the actual charge or maker rebate for that execution.

Funding rates move payments between long and short perpetual holders. Positive funding makes longs pay shorts; negative funding reverses the direction. The rate and exposure at the payment interval determine the adjustment. Funding differs from the trading fee charged on a fill, and portfolio-margin borrowing can add interest costs. An application may also charge an approved builder fee on eligible fills, within the maximum that the user authorized for that builder.

Order-book spread and market impact affect execution prices. A fee schedule alone does not measure the total cost of entering and holding exposure.

Deposits and Withdrawal Routes

Hyperliquid's web trading interface supports compatible wallets and email-based access. Authentication does not determine account mode or make every deposit route compatible. USDC deposits through Arbitrum remain one supported path. Other supported transfers and direct exchange withdrawals provide additional entry routes, subject to their asset and destination requirements. External spot-asset deposits may require conversion into the market's collateral or quote asset. HyperCore balances and HyperEVM balances belong to their respective execution components, so the destination matters alongside the network.

Withdrawals use the available balance that the account can release while satisfying its margin requirements. A trading fill and an external withdrawal have different completion conditions; route-specific processing and destination-chain settlement govern the latter. Deposit gas, bridge charges and withdrawal costs belong to their particular method. Wallet recovery material controls the account's signing authority and should never enter a trading form or a support conversation.

HyperCore, HyperEVM and HYPE

Two execution components connect native trading with programmable applications. HyperCore contains the order books and trading state, while HyperEVM runs Ethereum-compatible smart contracts. HyperCore and HyperEVM share HyperBFT consensus on the same blockchain. Smart contracts can read supported trading state through precompiles and submit supported actions through CoreWriter. Those interfaces have their own timing and authorization constraints.

HYPE is the native gas token for HyperEVM transactions and supports delegated staking in HyperCore. Gas spending, trading collateral and staking balances have different purposes. A staking withdrawal must clear its unstaking queue before the funds become spendable in spot. Validator commission reduces delegator rewards, and a jailed validator stops earning staking rewards. Smart-contract interaction adds the selected application's code and permissions to the native chain dependencies.

CoreWriter delays order actions before HyperCore processes them. A contract transaction receipt and a native trading fill describe different events.

Builder Markets and Vault Strategies

HIP-3 deployers define their markets' contract specifications, oracle operation and leverage limits. They can halt trading and settle positions at the current mark price. Vaults introduce strategy exposure alongside individually managed positions. Hyperliquidity Provider (HLP) combines market making, liquidations and lending, with depositors sharing its profit or loss. Legacy HyperCore vaults lack spot and HIP-3 trading, while HyperEVM vault designs can access supported markets through CoreWriter. Their accounting and withdrawal terms differ. Each HLP deposit restarts the withdrawal lock-up; its current terms specify the duration. Strategy losses can reduce a depositor's equity. Direct order placement leaves market selection and exit decisions with the account holder; a vault follows its strategy and the rules governing participation.

Illustration: Hyperliquid - Builder Markets and Vault Strategies

View full-size image

Before you start with Hyperliquid

Why Can an Order With Enough Collateral Fail at an Open Interest Cap?

An open interest cap can restrict increases in market exposure even when the account has sufficient collateral. Orders that increase or flip a position can fail under the cap, and prices more aggressive than the oracle price can also cause rejection or cancellation. The returned reason distinguishes this market-level constraint from insufficient margin. Changing the collateral amount alone does not remove a market's open interest restriction.

Which Address Belongs in an account-data Query When Trading Through an API Wallet?

Account-data queries need the actual master-account or subaccount address, not the API wallet address. An API wallet signs authorized actions on behalf of an account; its address does not identify the balances and positions of that account. Using the signing address in a balance query can return an empty result even when the trading account holds assets.

What Happens to Attached Exits When a Partially Filled Parent Order Is Canceled?

Manually canceling a partially filled parent order also cancels its attached take-profit and stop-loss orders. New position-linked exits must be placed separately if desired. A cancellation for insufficient margin has different behavior: after a partial fill, it places the attached exits as though the parent had fully filled. These exits retain their configured fixed sizes, so the cancellation reason matters alongside the executed quantity.

How Does a TWAP Order Behave When Liquidity Is Thin?

A time-weighted average price (TWAP) order can fall behind its execution target when suborders cannot fill within their slippage constraint. Later suborders attempt to catch up, subject to the protocol's size constraint. Some requested quantity can remain unexecuted when the schedule ends. A longer running time spreads the execution attempts over a different schedule; it does not guarantee sufficient liquidity.

Will Opposite Orders From the Same Address Trade Against Each Other?

Self-trade prevention cancels the resting order when matching would create a trade between the same address. The prevented match creates no fill and charges no trading fee; its cancellation does not appear in the trade feed. Any execution against other addresses remains subject to the incoming order's price and execution constraints, with fees applying to those actual fills.

What Makes a Leftover Spot Balance Too Small to Sell?

A leftover spot balance can be unsellable when it falls below the market's permitted lot size or minimum order value. The asset's size precision governs eligible quantities, while the submitted price determines the order's notional value. A positive balance can therefore remain too small for a valid sell order.

Are Subaccounts Included in the Master account's Margin Pool?

Subaccounts remain separate trading accounts, including under portfolio margin. Their eligible collateral and positions follow their own account requirements, even though their trading volume contributes to the master's shared fee tier. A fee-tier relationship does not combine collateral pools. Account queries and position reconciliation must identify the intended subaccount rather than treating the master balance as that subaccount's available margin.

Is Trading Activity Hidden Behind a Wallet Address?

A wallet address does not make onchain trading activity private. Public account queries expose fills, positions and balances associated with that address. Fill records include prices, sizes, timestamps and fees, so activity remains visible after an order leaves the book. Querying those public records requires neither a signing key nor a recovery phrase; those credentials remain secrets.