Hyperliquid API: a BTC liquidation map that flagged 90% of an $83 million wipeout
Every position on Hyperliquid is public, so you can work out where each one breaks. We mapped all of them for BTC, then watched the price fall into the map an hour later.

At 05:14 UTC on 3 December, $192 million of BTC positions on Hyperliquid sat within a 5% move of liquidation. Over the next hour BTC fell 4.2%, and accounts our map flagged made up 90% of the $83 million liquidated.
On most exchanges, positions are private, so a liquidation map is a guess from open interest. On Hyperliquid every open position sits in the exchange's public state. Bitquery copies that state about every 12 minutes, so you can work out where each position breaks. If you trade BTC with borrowed size, run a risk dashboard or build alerts, this map shows where forced selling waits.
- $192M
- 90%
- $44.0M
- +27%
- $47.8M
- 2×
What the liquidation map prints
The map is one Python script. It prints a price ladder: each 1% step above and below the price, the trades that would be wiped out there, and the stop-losses waiting at the same prices. Here is the output for the 05:14 UTC snapshot on 3 December:
Read it from the middle out. The orange line is the mark price, the price the exchange uses to decide who gets wiped out. Each row below it is one more percent down, with the longs that would go in that step. Each row above it is one percent up, with the shorts. Take the row marked -2%: if BTC fell 1% to 2%, $55.6 million of longs would hit their line, and $20.7 million of stop-losses would fire in the same range.
The code is on GitHub, bitquery/hyperliquid-liquidation-map. Run it in four commands:
git clone https://github.com/bitquery/hyperliquid-liquidation-map && cd hyperliquid-liquidation-map
pip install -r requirements.txt
echo 'BITQUERY_TOKEN=your_access_token' > .env
python liqmap.py
To get an access token, sign up for Bitquery and create one under API access tokens, as the token guide shows. The map uses plain GraphQL queries and no stream, so it runs on any self-service plan.
How the map works
Hyperliquid is an exchange for perps: futures that track a coin's price and never expire. A trader puts up margin, opens a position several times larger, and must keep a minimum, the maintenance margin. When losses eat the margin down to that minimum, the exchange closes the position. That price is the liquidation price. We call it the line.
The exchange keeps every account's state in public, but its own API returns it one address at a time. Bitquery's Hyperliquid API takes a snapshot of the whole exchange about every 12 minutes and keeps it for a week. The map reads five of the snapshot cubes, as Bitquery calls its datasets:
| Cube | One row per | What the map takes from it |
|---|---|---|
SnapshotMarkets | market | The mark price and the margin tiers |
SnapshotPositions | open position | Size, side, margin type, maintenance margin, isolated margin |
SnapshotAccounts | account on each perp exchange | The cross-margin value and maintenance margin of the whole account |
SnapshotBalances | spot balance | Spot USDC, which backs the perps of a unified account |
SnapshotOrders | order | Waiting stop-loss orders, which no public order book shows |
The snapshot docs list every field. A BTC map takes about half a minute to build.
Step 1: pick one snapshot for every cube
Every query must read the same snapshot, or margins from one moment meet trades from another. Pass the same time to each cube with Block: {Time: {at: $t}}, and the API answers with the newest snapshot at or before it:
query Positions($t: DateTime!, $coin: String!, $offset: Int!) {
Hyperliquid {
SnapshotPositions(
where: {Block: {Time: {at: $t}}, Market: {CoinRaw: {is: $coin}, Protocol: {is: "hypercore"}}}
orderBy: {descending: Valuation_PositionValue}
limit: {count: 10000, offset: $offset}
) {
Block { Number Time }
Trader { Address }
Position { Side Size EntryPrice Leverage IsCross }
Valuation { PositionValue MarkPx }
Margin { MaintenanceMargin IsolatedRawUsd }
}
}
}
Two details bite here. The at filter works to the second, while a snapshot's time carries fractions of one. Pass the exact block time, and you get the snapshot before it, so round up to the next second. And a fresh snapshot can show up in one cube a few minutes before another. The script asks for Block { Number } on every row, and with no time given it takes the newest snapshot that every cube has finished.
The main exchange is hypercore. A BTC snapshot holds tens of thousands of open trades, so the script pages through them ten thousand at a time.
Step 2: work out each liquidation price
The snapshot gives each position's size, mark price and maintenance margin, but not its line. Solve for it. A position is wiped out at the price p where the margin left equals the maintenance margin:
def liquidation_price(size, a, b, tiers):
"""Price p where a + size*p = b + rate*|size|*p - deduction."""
for i, (lower, rate, deduction) in enumerate(tiers):
upper = tiers[i + 1][0] if i + 1 < len(tiers) else math.inf
p = (b - deduction - a) / (size - rate * abs(size))
if p <= 0:
return 0.0 # never liquidated
if lower <= abs(size) * p < upper: # the tier that applies at that price
return p
return p
size is signed: negative for a short. rate is the maintenance margin, half the initial margin at the market's maximum, so 1.25% for BTC at 40x. Trades worth more than $150 million fall in a second tier with a higher rate, which is why the loop checks the tier at the line.
What goes into a and b depends on the margin type:
- Isolated: the trade carries its own margin.
aisMargin.IsolatedRawUsdandbis 0. - Cross: the trade shares the account's margin.
ais the account's cross value with this trade taken out, andbis the maintenance margin of its other trades, held at their current prices.
This matches the formula in the exchange's docs. For cross trades, working out the account's value takes more than one cube, and the first trap below explains why.
Step 3: add the stop-losses
A stop-loss is an order that waits off the book until the price crosses its trigger, then closes the trade. Waiting orders sit in SnapshotOrders with IsTrigger: true:
SnapshotOrders(
where: {Block: {Time: {at: $t}}, Market: {CoinRaw: {is: "BTC"}}, IsTrigger: true}
limit: {count: 50000}
) {
Trader { Address }
Side OrderType TriggerPx Size IsPositionTpsl
}
The map counts orders whose OrderType contains Stop: sell stops below the price close longs, buy stops above it close shorts. Orders that take profit stay off the map. Stops matter for two reasons. They add selling or buying at the same prices as the forced sales. And a stop set above a line closes the trade first, as the test below shows.
Step 4: build the ladder
With a line for every trade, the ladder is a count. Each trade goes into the 1% step its line falls in, and its value at the mark price is added there. Stops go in by their trigger price:
def step_of(price, mark, step=1.0):
"""+1 is the first step above the mark, -1 the first below."""
move = (price / mark - 1) * 100 / step
return math.floor(move) + 1 if move >= 0 else -(math.floor(-move) + 1)
Longs only count below the price and shorts only above it. python liqmap.py --out data/ also writes every trade with its line, and the ladder, as CSV files.
Step 5: check it against Hyperliquid
The exchange's own info API returns a liquidationPx for each trade of one account. check_hyperliquid.py builds the map from the newest snapshot, picks the largest trades near their line plus a few hundred at random, and asks the exchange for each one. It compares only trades that did not change between the snapshot and the check:
Of the trades that had not changed, 83% matched the exchange's own line within 0.1%, and 92% within 1%. Every isolated trade matched. Most of the misses were cross accounts holding other coins, which kept moving between the snapshot and the check. Most of the rest were portfolio-margin accounts, which also count spot coins such as BTC as margin.
The BTC liquidation map at 05:14 UTC
Here is the whole map at the 05:14 snapshot. Far more longs than shorts sat close to their line:
The map leaned hard to one side. Within 5%, longs came to three times the shorts, and the biggest cluster sat just 1% to 2% below the price. The stop-losses lined up with it: $47.8 million of sell stops waited in the first 5% down.
A few accounts held much of that risk:
What happened next
BTC started to slide a minute after the snapshot. Within the hour the mark price had fallen 4.2%, and the longs went in waves:
backtest.py takes the map at 05:14 and every forced sale until 06:30, and splits the money both ways. It flags every long whose line sat above the lowest mark price at which a long was wiped out. Then it asks two things: how much of what was wiped out did the map flag, and what became of what it flagged?
Of the $83.0 million of longs wiped out, 90.4% came from accounts the map had flagged. Trades opened after the snapshot made up 5.4%, and the map never saw them. The last 4.3% came from accounts the map held but did not flag. Most of those hold other coins on cross margin, and those coins fell with BTC, while the map holds them still.
Of what the map flagged, about a third escaped. $19.2 million closed first through a stop-loss set above the line, and $21.8 million was closed by hand. For a trader, that is the case for a stop. For a map, it means the dollars at a step are an upper bound: some of them will leave by the stop door first.
What breaks: four traps in Hyperliquid liquidation data
Four traps gave our map wrong numbers on live data. Each one comes with the rows that show it.
1. Spot USDC backs most cross accounts
The exchange has account modes. In a standard account, perps and spot keep separate balances. In a unified account, the most common mode, spot USDC backs the perp trades too, and cross margin is shared across every perp exchange that settles in USDC. Of the 173 cross accounts we checked, 126 were unified.
The snapshot splits that money. SnapshotAccounts holds the cross value on each perp exchange, and SnapshotBalances holds the spot USDC. Read only the main exchange's cross value and many big longs look close to their line when they are safe. Read that way, BTC longs within 5% came to $184.2 million. With spot USDC and every USDC exchange added, they came to $145.3 million.
The API does not say which mode an account uses. The map assumes unified, the common case, and --standard switches to the other reading. The exchange's info API returns the mode with {"type": "userAbstraction"}, one account at a time.
2. A position stop-loss has a size of 0
A trader can set a stop on the whole trade, and it closes all of it, whatever the size. SnapshotOrders reports that order with IsPositionTpsl: true and Size: 0. At 05:14, more than one trigger order in four on BTC was like that.
The biggest stop within 5% belonged to one account: a buy stop 2% above the price that closes a $46.9 million short. At its trigger it was worth $47.8 million, and its Size read 0. Take the size from the owner's row in SnapshotPositions, as the script does.
3. Every liquidation fill appears twice
PerpLiquidations holds one row for each side of a forced fill: the account being wiped out and the trader on the other side. Both rows carry the same LiquidatedUser. Over the fall, the BTC rows added up to $170.4 million. The side of the accounts being wiped out came to $85.2 million, exactly half. Keep the rows where Trader.Address equals LiquidatedUser.
4. The map's dollars arrive in slices
The map counts each position's full value at its line. The exchange closes positions over $100,000 in slices: a fifth goes to the order book first, and any further forced sale in the next 30 seconds takes the rest. Of the $192 million within 5%, 87% sat in positions above that size. Add the stops that fire first and the traders who top up, and the forced sales that print come in below the map's total. On 3 December, $135.5 million was flagged and $83.0 million was wiped out.
What it costs
The map runs on GraphQL queries alone. Snapshots have no stream, so it uses no stream-minutes and no stream data. One BTC map took 28 queries: the market, four pages of positions, 11 batches each of accounts and spot balances, and the trigger orders.
Bitquery bills each query in points, by how much data it reads. Hyperliquid data is included on every self-service plan: Personal at $49 a month with 100,000 points, Pro at $99 with 1 million and Scale at $299 with 5 million. We read these prices on the pricing page on 3 December 2026.
Two changes cut the points a map uses. Ask only for the fields you print. And narrow the stop orders to the range you chart with a TriggerPx filter, instead of reading every trigger order in the market.
Limits
- About 12 minutes old. A snapshot is taken about every 12 minutes and shows up in the API a few minutes later. The map misses trades opened after the snapshot: 5.4% of the forced sales in our test.
- A week of snapshots. Snapshots stay in the API for a week, and forced sales and fills for about a month. The Data Store sells the event history as files, but not snapshots.
- One coin moves at a time. For cross accounts with other trades, the map holds the other coins at their snapshot prices. In a real fall they move together.
- Account mode is assumed. The map treats every cross account as unified. Portfolio-margin accounts, which count spot coins such as HYPE as margin, will read closer to their line than they are.
- Main exchange only. The map reads BTC on
hypercore. BTC markets on HIP-3 exchanges, which outside teams run on Hyperliquid, are separate. - No order placement. The code reads data only. It places no orders and holds no keys.
How we tested
- The map. The snapshot at 05:14:54 UTC on 3 December, block 1243610000, read with
liqmap.py. Every row of every cube carried the same block number. Each dollar figure is a position's value at the snapshot's mark price. - The check.
check_hyperliquid.pyon the 07:12 UTC snapshot of 3 December: the 50 largest positions within 10% of their line and 250 at random, compared with Hyperliquid'sclearinghouseStateminutes later. Of the 300, 37 had changed or closed and were left out. - The backtest.
backtest.pyfrom the 05:14 snapshot to 06:30 UTC. A long counts as flagged when its liquidation price sat at or above $56,130.8, the lowest mark at which a long was liquidated. Liquidated value is fill size times price, liquidated side only. - The escapes. For the 677 flagged accounts that were not liquidated, we read their stop orders at 05:14, their BTC fills until 06:30 and their positions at 06:25.
We used AI tools to write and run the queries, and we checked each figure against the API. The data behind every number and chart is saved with the article.
Hyperliquid history as files
The API keeps snapshots for 7 days and liquidations for about 30. For a backtest over months, use the Hyperliquid dataset in the Data Store. It holds trades, liquidations, order updates, book updates, price updates, funding and TWAPs as Parquet files, with a free sample of most tables. The latest month costs $600.
FAQ
Does Hyperliquid do full liquidation?
Not always. A liquidated position under $100,000 goes to the order book in full. For a larger one, only 20% goes to the book first. Any further liquidation of that account in the next 30 seconds takes the whole position. If the account value falls below two thirds of the maintenance margin, Hyperliquid's liquidator vault takes the position over, and the trader does not get the maintenance margin back.
How do you read a liquidation map?
Find the current price, then read outward. Each step below it shows the longs that would be liquidated if the price fell that far, and each step above it shows the shorts. A tall bar means a cluster of forced orders at that price. On Hyperliquid the map is built from real positions, so the bars are dollar values, with a known timestamp.
How is a Hyperliquid liquidation price calculated?
A position is liquidated when its margin falls to the maintenance margin, half the initial margin at the market's maximum. For BTC, that is 1.25% of the position's value. Isolated positions count only their own margin. Cross positions count the account's whole value, and in a unified account that includes spot USDC.
Is the Hyperliquid API free?
Hyperliquid's own info API is free, but it returns state for one address at a time. Bitquery's API returns every position of a market from one snapshot. It is included on every self-service plan from $49 a month, with a 7-day free trial.
How far back does Hyperliquid position data go?
Bitquery keeps full-exchange snapshots for 7 days, one about every 12 minutes, so you can rebuild the map at any of them. Liquidations and trades go back about 30 days. Older event history is sold as Parquet files in the Data Store.
Related reading
- Bitquery Hyperliquid API: the product behind this map
- Hyperliquid snapshots and liquidation history by wallet in the docs
- Bitquery vs Hyperliquid's free API
- A 20% fall in HYPE would push $172.7 million of Hyperliquid loans past the liquidation line
- 64% of wallets in Hyperliquid's user vaults are down
- Polymarket API: build a live trade feed, the first guide in this series
Subscribe to our newsletter
Subscribe and never miss any updates related to our APIs, new developments & latest news etc. Our newsletter is sent once a week on Monday.