Back to Blog

Examples

Example: BTC Liquidation Heatmap

Example: BTC Liquidation Heatmap

Visualizing Liquidation Events

We built an open-source Jupyter notebook that visualizes BTC liquidation events on Hyperliquid using historical data from 0xArchive.

What It Does

  • Fetches liquidation data via the oxarchive Python SDK
  • Deduplicates trade records and maps long vs short positions
  • Generates 6 visualizations:

Price vs time liquidation heatmap - density map of liquidation activity

Scatter plot with BTC price overlay - longs in red, shorts in green

Hourly liquidation volume distribution - when do liquidations cluster?

Size distribution with percentile stats - how large are typical liquidations?

Cascade detection - finds P99 liquidation bursts in 5-min windows

Long vs short imbalance over time with price subplot

Example Output (3-day window)

13,399 unique liquidations - shorts hit 2x harder (64.9%) than longs (35.1%), $143M total notional.

Get Started

pip install -r requirements.txt
cp .env.example .env
jupyter notebook liquidation_heatmap.ipynb

Works with a free API key from 0xarchive.io/dashboard (BTC, 30-day lookback).

Links

We're planning more examples - funding rate arb, OI divergence, market microstructure.