Developer guideHyperliquid APIPython · GraphQL

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.

Cover Image for Hyperliquid API: Build a BTC Liquidation Map That Flagged 90% of an $83M Wipeout

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.

At a glance
The map reads one snapshot of the exchange from the Bitquery API: every open BTC position, the margin behind it and every waiting stop order. It works out each position's liquidation price, then adds up the dollars at each 1% step above and below the price. We built it from the 05:14 UTC snapshot on 3 December, checked it against Hyperliquid's own numbers, and compared it with the liquidations of the next hour.
$192M
BTC positions within a 5% move of liquidation
90%
Of the next hour's liquidations came from flagged accounts
$83.0M
BTC longs liquidated as the price fell 4.2%
38,589
Open BTC positions in the snapshot
Key findingsEach line has its own share link
  1. $192M

    BTC positions within a 5% move of liquidation at 05:14 UTC on 3 December: $145.3 million of longs below the price and $46.7 million of shorts above it.

  2. 90%

    Of the $83.0 million of BTC longs liquidated in the next 75 minutes, 90.4% came from accounts the map had flagged.

  3. $44.0M

    Flagged positions that escaped. $19.2 million of them closed first through a stop-loss set above the liquidation price.

  4. +27%

    Too much risk if you skip spot USDC. Hyperliquid's unified accounts back their perps with it; leave it out and longs within 5% read $184.2 million.

  5. $47.8M

    One stop-loss order, 2% above the price, that the API reports with a size of 0. It closes a whole $46.9 million short.

  6. 2×

    What you get if you sum every liquidation row. The data holds both sides of each fill, so keep the liquidated account's side.

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:

Terminal output of liqmap.py for the 05:14 UTC snapshot on 3 December 2026: BTC mark price 58,611 dollars, shorts liquidated at each 1% step above the price and longs at each step below, with stop-loss orders, and the total within a 5% move

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:

CubeOne row perWhat the map takes from it
SnapshotMarketsmarketThe mark price and the margin tiers
SnapshotPositionsopen positionSize, side, margin type, maintenance margin, isolated margin
SnapshotAccountsaccount on each perp exchangeThe cross-margin value and maintenance margin of the whole account
SnapshotBalancesspot balanceSpot USDC, which backs the perps of a unified account
SnapshotOrdersorderWaiting 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. a is Margin.IsolatedRawUsd and b is 0.
  • Cross: the trade shares the account's margin. a is the account's cross value with this trade taken out, and b is 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:

Our liquidation prices match Hyperliquid's own263 positions checked against Hyperliquid's info API
OUR LIQUIDATION PRICE AGAINST HYPERLIQUID'S, SHARE OF POSITIONSwithin 0.1%within 1%Isolated positions (112)100%100%Cross, BTC only (83)92%90%Cross, with other positions (68)78%46%Only positions unchanged between the snapshot and the check are compared.
Cross positions in accounts with other open positions drift most: the other coins kept moving between the snapshot and the check, and the map holds them at their snapshot prices.

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:

Where BTC positions on Hyperliquid would be liquidated3 December 2026, 05:14:54 UTC snapshot
BTC POSITIONS LIQUIDATED AT EACH 1% STEP, AND STOP-LOSSES THEREshorts liquidatedlongs liquidatedstop-loss orders$64,472 +10%$8.3M$63,886 +9%$70.9M$63,300 +8%$28.2M$62,714 +7%$8.7M$62,128 +6%$10.8M$61,542 +5%$10.3M$60,955 +4%$60,369 +3%$14.8M$58.9M of stops$59,783 +2%$16.8M$59,197 +1%$58,025 −1%$23.1M$57,439 −2%$55.6M$56,853 −3%$29.6M$56,267 −4%$26.0M$55,680 −5%$11.1M$55,094 −6%$71.7M$54,508 −7%$23.5M$53,922 −8%$10.7M$53,336 −9%$97.2M$52,750 −10%$9.9Mmark $58,611, 05:14:54 UTCby 06:15 the mark fell to $56,131, −4.2%Each row is one 1% step and ends at its price: the row marked −1% runs from the mark down 1%. Value at the mark price.
38,589 open BTC positions. Within a 5% move: $145.3M of longs below the price and $46.7M of shorts above it. The amber lines are stop-loss orders, sized from each owner's position where the order closes the whole position.

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:

The 20 largest positions hold half the riskBTC positions within 5% of liquidation, 05:14:54 UTC
SHARE OF THE $192.0M WITHIN 5% HELD BY THE LARGEST POSITIONSlargest one9%largest 217%largest 529%largest 1038%largest 2049%largest 10079%5,386 positions within 5%. The median one was worth $584.
201 positions over $100,000 hold 87% of the value. Hyperliquid sends the first 20% of each to the order book, so a map's dollar total can take minutes to print.

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:

BTC fell 4% in an hour, and the longs went in waves3 December 2026, 04:30 to 07:30 UTC
BTC PRICE (LINE) AND LONGS LIQUIDATED EVERY 5 MINUTES (BARS)55.5k56.0k56.5k57.0k57.5k58.0k58.5k59.0k59.5k05:0006:0007:0005:14 snapshot$14.2M in 5 minutesBars: $83.0M of longs liquidated from 05:14:54 to 06:30 UTC, liquidated side of each fill only.
5-minute candles and liquidations from Bitquery's Hyperliquid API. The trade price touched $56,038; liquidations trigger on the mark price, which bottomed at $56,130.8.

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?

The map flagged the accounts behind 90% of the liquidationsBTC longs, 3 December 2026, 05:14:54 to 06:30 UTC
THE 05:14 MAP AGAINST WHAT HAPPENED BY 06:30 UTCLiquidated after 05:14, $83.0Mflagged by the map 90.4%held, not flagged 4.3%opened later 5.4%Flagged at 05:14, $135.5Mliquidated, in part or in full $91.5Mstop fired first $19.2Mclosed by hand $21.8Mstill open $3.0M
A position counts as flagged when its liquidation price sat above the lowest mark a long was liquidated at, $56,130.8. 3,060 of the 3,737 flagged accounts were liquidated. The flagged value is at the snapshot's price; liquidations are fills, often in slices.

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.

Read the Size field, and you miss the biggest stopBTC stop-loss orders, 3 December 2026, 05:14:54 UTC
STOP-LOSS ORDERS WITHIN 5% OF THE PRICE, 05:14 UTCSize as reportedwith position stops sizedBuy stops, 0–5% above$11.8M$85.2MSell stops, 0–5% below$19.2M$47.8MThe biggest, one account's stop at $59,809, closes a $46.9M short. Its Size field is 0.
5,913 of 21,465 trigger orders were position stop-losses or take-profits. Each closes the whole position, so the API reports its size as 0.

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.py on the 07:12 UTC snapshot of 3 December: the 50 largest positions within 10% of their line and 250 at random, compared with Hyperliquid's clearinghouseState minutes later. Of the 300, 37 had changed or closed and were left out.
  • The backtest. backtest.py from 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

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.