Skip to main content

What you'll build

A notebook that pulls Binance Futures data from Kwery, overlays price movements with open interest changes, and identifies historical patterns consistent with liquidation cascades.

Prerequisites

  • A Kwery API key (get one here)
  • Python 3.10+
  • requests, pandas, and matplotlib installed

Outline

  1. Fetch futures market data and ticker snapshots
  2. Build a time-series of price and open interest
  3. Detect sharp OI drops coinciding with price moves
  4. Classify potential cascade events
  5. Visualize cascade anatomy

Step 1 — Fetch futures data

Use /v1/binance/futures/{symbol} and /v1/binance/futures/{symbol}/ticker to pull market state and ticker data for a target symbol.

curl "https://kwery-api.com/v1/binance/futures/ETHUSDT/ticker?api-key=YOUR_KEY"

Section coming soon — will include Python code for batch fetching across multiple timepoints.

Step 2 — Build price and open interest series

Parse the response data into a DataFrame with timestamp, mark price, and open interest columns.

Section coming soon.

Step 3 — Detect anomalous OI drops

Flag intervals where open interest declines by more than a configurable percentage within a short window, coinciding with a directional price move.

Section coming soon.

Step 4 — Classify cascade events

Score each detected event by magnitude, speed, and whether the price move accelerated after the initial OI drop.

Section coming soon.

Step 5 — Visualize

Plot price, open interest, and detected cascade events on a shared timeline.

Section coming soon.


Next steps

  • Extend to multiple symbols and build a cross-asset cascade risk score
  • Combine with Hyperliquid data via /v1/hyperliquid for multi-venue analysis
  • Set up real-time monitoring with periodic polling