BlogDeveloper

Hyperliquid Liquidation Data: How It Works and the API

How Hyperliquid liquidations work (order book, backstop and ADL) and how to query liquidation history, live events and liquidation prices in Python.

HydromancerTeam
Hyperliquid Liquidation Data: How It Works and the API

Hyperliquid liquidation data records positions that were forcibly reduced or closed, including the market, price, size and whether the liquidation used the order book or a backstop. Builders can use these records to monitor market stress, add execution controls and build liquidation dashboards.

The useful part is not the big red number. It is understanding what produced it, which accounts were affected and what the market looked like at the time.

This guide explains how to read those events and turn them into a practical application: a liquidation-stress panel for one market, with historical data, live updates and a visible indication of whether the data is complete.

If you're a trader and want to know where your own position gets liquidated, the liquidation price formula below shows how Hyperliquid works it out.

How Hyperliquid liquidations work: order book, backstop and ADL

A position is liquidated when the account's equity falls below its maintenance margin. Maintenance margin is half the initial margin at max leverage, so 1.25% on a 40x market and about 16.7% on a 3x market. Hyperliquid checks this against the mark price, not the last trade.

Hyperliquid then works through up to three stages. Your data needs to tell them apart:

StageWhenWhat happensShown as
Order-book liquidationEquity below maintenance marginMarket orders close the position; the trader keeps any margin leftmethod: "market"
Backstop liquidationEquity below two-thirds of maintenance marginThe liquidator vault or a HIP-3 backstop takes the position overmethod: "backstop"
Auto-deleveraging (ADL)Account or isolated position value below zeroProfitable traders on the other side are closed, ranked by unrealized PnL and leverageSeparate ADL event

For positions over 100k USDC, only 20% goes to the book at first. A 30-second cooldown follows, and any market liquidation order for that trader during the cooldown is for the entire position. There's no liquidation fee on the order-book stage.

Hyperliquid's docs give the liquidation price of a position as:

code
liq_price = price - side * margin_available / position_size / (1 - l * side)

side is 1 for a long and -1 for a short, and l is 1 divided by the maintenance leverage for that position's margin tier. For cross-margin positions the liquidation price moves when funding is paid or another position's PnL changes.

A useful liquidation record tells you:

Those two prices have different jobs. Mark price determines liquidation eligibility; an order-book liquidation executes against available liquidity. They can differ, especially during volatility.

If your application needs both, our Hyperliquid oracle, mark and mid-price data explains the pricing context.

How a Hyperliquid liquidation happens: an account falls below maintenance margin based on the mark price, the order book liquidates first, and a backstop liquidator (HLP or a HIP-3 DEX backstop) takes over only if the book does not succeed; each record shows who, what, when, at what price and how

How is liquidation data used in trading?

1. Monitor cascade risk

A liquidation cascade is the feedback loop traders worry about: forced buying or selling puts pressure on the market, more positions become vulnerable, and further liquidations follow.

Look at the pace of liquidation notional, the number of affected accounts and the liquidity available to absorb order-book liquidations. The same amount of forced flow can mean very different things in a deep book and a thin one.

Our analysis of how Hyperliquid priced in Dario's tweet provides a concrete example of examining liquidations alongside market depth. This guide focuses on building the monitoring workflow rather than repeating that event study.

Treat the result as context, not an automatic trade signal. A liquidation spike alone does not tell you whether the move is ending or accelerating.

2. Assess crowding: realized prints versus projected liquidation prices

Historical liquidation prints show what happened. Projected liquidation prices show where currently tracked positions could become vulnerable.

Use separate layers for them. Plot historical events at their fill prices. Build a projected-risk layer from current position state, including liquidationPx and the account snapshot time.

The projected layer needs refreshing. Hyperliquid explains that liquidation prices can change with funding and, for cross-margin positions, PnL elsewhere in the account.

Coverage matters too. If you track a selected set of wallets, label it as that set. Do not turn a partial view into a chart called “all Hyperliquid liquidation levels.”

3. Read the order-book versus backstop mix

Hydromancer's historical records distinguish market liquidations from backstop liquidations.

That lets you ask a more specific question than “How much was liquidated?”: how much was handled by the book, and how much reached the backstop?

Compare the methods over the same market and time window. Use notional rather than fill count when measuring the amount of exposure involved. A large transfer and a small fill should not contribute equally to a notional-based chart.

A rising backstop share is a reason to investigate liquidity and account conditions—not proof of insolvency. Keep backstop transfers separate when analyzing aggressive order-book flow.

What do builders use liquidation data for?

1. Risk engines and account alerts

Build warnings that combine a user's current position risk with wider market conditions. For example, an application could flag a vulnerable position while liquidation activity in that market is increasing.

The event feed is the market context. Current account state is what makes the warning relevant to that user. A message sent after their liquidation is a notification, not prevention.

2. Execution controls

An execution system can combine liquidation activity with spread and depth to adjust order size, participation or temporary pauses.

Align the timestamps. Comparing an earlier liquidation with the current book can make liquidity appear to have been available when it was not. Our BBO, L2Book and L4Book guide explains which book view fits which workload.

3. HLP and HIP-3 backstop monitoring

Track acquired exposure, market concentration and subsequent position changes for the relevant backstop account.

Identify that account correctly: Hyperliquid describes its liquidator vault as a component strategy of HLP, while HIP-3 documentation describes DEX-specific onchain backstop liquidators with their own scope and eligibility conditions.

A takeover is one event, not the entire balance sheet. Add account-state data before drawing conclusions about exposure or financial health.

4. Attribution and user-facing products

Liquidation tickers, historical maps and builder-attributed dashboards answer different product questions. Choose the dataset that matches the label.

For builder analytics, builderLiquidations uses last-touch attribution: the user's last non-liquidation fill for the coin must carry the builder code. The docs also note that a preceding TWAP fill produces no notification because TWAP fills do not carry builder codes. Unlike liquidationFills, this stream merges multi-fill liquidations by default (aggregateByTime defaults to true), so set it the same way on both before comparing counts.

For volume analysis, start with liquidation versus non-liquidation volume, not “forced versus organic.” Non-liquidation activity is not automatically organic, and ADL requires its own classification.

Build a liquidation-stress panel for Hyperliquid

Start with one market. BTC is a straightforward scope for the first version: one identifier, one set of units and fewer opportunities to combine unrelated records.

The example below is an implementation blueprint, not a live market reading. Its output is a panel with four views:

ViewWhat to display
Liquidation activityFive-minute buckets of liquidation notional, split by liquidated longs and shorts
Liquidation methodMarket and backstop notional over the selected period
Affected accountsDistinct liquidated accounts, not the number of fills
Data healthConnection state, last processed event and any unresolved gaps

Keep the bucketing interval configurable. The point is to make the definitions explicit before putting a chart in front of a user.

Step 1: Load a historical window

Use liquidationHistoryByTime for a coin and time range. It accepts inclusive millisecond startTime and endTime bounds, returns newest-first results and caps requests at 1,000 records.

This minimal request retrieves recent BTC events. For the panel, add the time bounds matching the selected window:

cURL

bash
curl 'https://api.hydromancer.xyz/info' \
-H "Authorization: Bearer $HYDROMANCER_API_KEY" \
-H 'Content-Type: application/json' \
-H 'User-Agent: Mozilla/5.0' \
--data '{"type":"liquidationHistoryByTime","coin":"BTC","limit":100}'

Hyperliquid's own API has no market-wide liquidation history; you'd have to read each wallet's fills one by one. The same request in Python, printing the liquidated side, size, price and method:

Python

code
import os, requests

r = requests.post(
    "https://api.hydromancer.xyz/info",
    headers={"Authorization": "Bearer " + os.environ["HYDROMANCER_API_KEY"]},
    json={"type": "liquidationHistoryByTime", "coin": "BTC", "limit": 5},
)
for ev in r.json():
    side = "long" if ev["side"] == "A" else "short"
    method = ev["liquidation"]["method"]
    print(ev["time"], side, ev["sz"], "@", ev["px"], method)

Output

code
1793083866111 long 0.53966 @ 79552.00 market
1793083866111 long 0.6973 @ 79552.00 market

History starts on 28 July 2025. Leave out coin to get every market, or use a HIP-3 name like xyz:XYZ100.

A response at the requested limit may be truncated. Split busy intervals and reconcile their boundaries. If a single-timestamp interval still reaches the cap, confirm a supported retrieval approach rather than skipping records and calling the window complete.

For larger studies, use the daily liquidation files described on our Reservoir archive page. Liquidation files are subsets of the all-fills dataset; summing both double-counts those records. S3 is requester-pays, so AWS retrieval costs can apply.

Step 2: Establish the event contract

Normalize historical records into a small internal schema:

Internal fieldHistorical response field
Marketcoin
Event timetime
Liquidated accountliquidation.liquidatedUser
Fill price and sizepx, sz
Liquidated position sideside: A = long; B = short
Methodliquidation.method
Mark price at liquidationliquidation.markPx
Source identifiersPreserve hash, tid, oid and txIndex

These mappings follow the historical endpoint's documented account perspective.

Use decimal arithmetic for financial values. Compute each record's notional as fill price multiplied by absolute size, in the market's quote units. Notional is exposure transferred or closed—not the trader's loss.

Do not assume every WebSocket fill has the same account perspective. Normalize live records against liquidation.liquidatedUser before applying the historical long/short mapping.

Step 3: Add live events without leaving a gap

After authenticating a backend WebSocket connection, subscribe to the documented liquidation stream:

WebSocket subscription (JSON)

json
{"type":"subscribe","subscription":{"type":"liquidationFills"}}

The subscription shown is market-wide. Filter incoming records to coin === "BTC" for this panel; do not assume the stream accepts the REST endpoint's coin filter.

Messages carry a fills array of address-and-fill pairs, batched per block. If you add the optional aggregateByTime: true to the subscription, all fills of one order for one user in one block arrive as a single fill carrying the first trade's time, txIndex and tid, so you get fewer records for the same notional.

For initial synchronization, buffer live events while loading a historical window that overlaps the buffer. Normalize both sources, reconcile their overlapping records, then continue with live updates. Verify the cross-source event identity before merging; do not deduplicate just because two records share a price and size.

Keep credentials on the backend, not in the browser bundle. Our data-feeds guide covers the broader streaming setup.

Joining Hyperliquid liquidation history and live data without a gap: buffer the liquidationFills WebSocket stream, load a liquidationHistoryByTime window that overlaps the buffer, reconcile overlapping events by identity, then continue with live updates

Step 4: Calculate the panel's metrics

For each time bucket:

  • Sum normalized liquidation notional separately for longs and shorts.
  • Split notional by market and backstop; preserve unknown methods separately if encountered.
  • Count distinct liquidatedUser addresses. Multiple fills from one account are not multiple affected accounts.
  • Keep the most recent processed event time and the ingestion status alongside the totals.

For a backstop-share chart, divide backstop notional by the combined market-and-backstop notional in the same window. Show N/A if there are no classified events; zero is a different statement.

When comparing this panel with total traded volume, reconcile account-side fills to a consistent volume convention. Do not count both sides of an ordinary trade but only one side of a liquidation and call the ratio comparable.

Step 5: Make interruptions visible

Store the cursor only after successfully processing its message. Handle replay messages as well as live messages, and use idempotent writes so retries do not inflate totals.

The documented session grace period is 30 seconds: reconnect with the same sessionId in that time and your subscriptions are restored. Replay from your saved cursor reaches further back, up to 15 minutes for liquidationFills. A cursor older than that replays only what is retained and sets hasGap: true. Longer interruptions, and any replay flagged with hasGap, need historical backfill and reconciliation.

For liquidation-stream replay, the docs specify (time, txIndex) deduplication. That rule belongs to the stream's replay handling; it is not a substitute for verifying identity across REST, WebSocket and archive data.

Show an unresolved gap in the panel instead of a misleading zero. Also distinguish the last event timestamp from connection health: a quiet market can have no new liquidations while the connection is healthy.

Step 6: Check the result before expanding

Before adding more markets, verify that:

  • Replaying a processed batch leaves totals unchanged.
  • Several fills from one account still count as one affected account within the selected window.
  • Market and backstop subtotals reconcile with the classified total.
  • Historical response caps and reconnect gaps are detected, not silently ignored.
  • The live/REST overlap does not duplicate events.

Then add mark-price and order-book observations for market context. For account-specific risk features, add fresh position snapshots separately. Review the rate-limit guide before expanding the polling workload.

How to see liquidation risk before it happens

Liquidation history shows where forced selling already hit. A risk view also shows where it could hit next:

What you wantRequestWhat you get
Liquidation prices across many walletsbatchClearinghouseStatesliquidationPx, size and entry for up to 1,000 wallets per request, or 100 with dex: "ALL_DEXES", which adds HIP-3 positions
Stop-losses that haven't fired yettpslBookUntriggered TP/SL orders (typically about 110,000 across about 330 markets) with wallet, trigger price and size
How close every position on a market is to liquidationperpSnapshots (add-on)Every trader's position on a market, with size, leverage and liquidation price

For example, one perpSnapshots request for BTC on 27 October 2026 returned 42,841 positions. With BTC at $79,730, 1,706 of them, worth $50.5M, had a liquidation price within 1% of the mark price.

Stop-losses aren't on the order book until they trigger, so neither layer shows up in a normal book view. Our order book heatmap guide shows how to draw them next to book depth.

What liquidation data does Hydromancer provide?

Use this as a reference when choosing the inputs for your application:

InterfaceUse it forImportant boundary
liquidationFillsReal-time liquidation ingestionLive payloads use fills; handle replay and account perspective.
liquidationHistoryByTimeHistorical charts and reconciliationFrom 28 July 2025, newest first, up to 1,000 per request; split busy windows.
builderLiquidationsBuilder-attributed monitoringLast-touch attribution, not every liquidation from every past app user; payloads use liquidations.
clearinghouseStateCurrent account positions and projected riskRequires an identified account; not an executed-event feed.
tpslBookStop-loss and take-profit clustersUntriggered orders only; binary response, decode with the SDK.
Reservoir liquidation filesBulk historical researchDaily archive, not a live feed; subsets overlap with all-fills data.

FAQ

Does Hyperliquid's API have a liquidation endpoint?

Not a market-wide one. Liquidations show up inside each wallet's fills, one wallet at a time. Hydromancer's liquidationHistoryByTime and liquidationFills cover every market.

What's the difference between a market and a backstop liquidation?

A market liquidation closes the position on the order book, and the trader keeps any margin left. If equity falls below two-thirds of maintenance margin, the liquidator vault takes the position over and keeps the maintenance margin.

Does Hyperliquid charge a liquidation fee?

No, not on order-book liquidations.

How far back does liquidation history go?

To 28 July 2025, both in the API and in Reservoir's daily files.

For a first build, get one market working end to end. A small panel with correct totals and honest gap reporting is more useful than a market-wide map you cannot reconcile.

Our liquidation data product page gives the overview, and the API-key guide explains how to get access.

Continue