Liquidation Order Stream

The liquidation order snapshot stream provides liquidation order information for trading pairs in the market. Receive liquidation orders for futures across the whole market in real time over WebSocket: every time a forced liquidation happens on an exchange, you receive its exchange, trading pair, side, price and amount. Suitable for liquidation alerts, real-time dashboards and risk control signals.

The following API plans can call this endpoint: Standard Professional Enterprise

WS
liquidation_orders
Key Facts
ItemDetails
Connection URLwss://open-ws.coinglass.com/ws-api?cg-api-key=YOUR_API_KEY
Subscribe messagemethod is subscribe, channels is ["liquidation_orders"]
HeartbeatWe recommend sending ping every 20 seconds; receiving pong means the connection is working
Message fieldsbase_asset, exchange, symbol, price, side, volume_usd, time (milliseconds)
API planStandard and above
Querying missed dataThe REST Liquidation Orders endpoint; last 7 days

Real-Time Liquidation Order Push

Channel: liquidation_orders

To subscribe to the liquidation_orders channel, send the following message:

{
    "method": "subscribe",
    "channels": ["liquidation_orders"]
}

Response Example

When data is received, the response looks like this:

{
    "channel": "liquidation_orders",
    "data": [
        {
            "base_asset": "BTC",
            "exchange": "Binance",
            "price": 56738.00,
            "side": 2, //side=1   Long liquidation     side=2   Short liquidation
            "symbol": "BTCUSDT",
            "time": 1725416318379,
            "volume_usd": 3858.18400
        }
    ]
}
FieldDescription
base_assetCoin
exchangeExchange
symbolTrading pair
priceLiquidation price
sideSide: 1 is a long liquidation, 2 is a short liquidation
volume_usdLiquidation amount (USD)
timeLiquidation time, timestamp in milliseconds

Connecting and Subscribing

  1. Connect: Append your API Key to the URL: wss://open-ws.coinglass.com/ws-api?cg-api-key=YOUR_API_KEY
  2. Subscribe to the channel: After connecting, send {"method": "subscribe", "channels": ["liquidation_orders"]}
  3. Keep the heartbeat going: We recommend sending ping every 20 seconds; receiving pong means the connection is working
  4. Unsubscribe: When you no longer need it, send {"method": "unsubscribe", "channels": ["liquidation_orders"]}

For general instructions on connecting, see WebSocket Getting Started.

Complete Example

Ignore the pong heartbeat response. For text ending in need upgrade plan, log the full rejected subscription string and continue receiving data from other subscriptions. Parse other messages as JSON; an unparseable message does not stop the receiver.

// Run on your server; Node.js 22 and above have WebSocket built in
const ws = new WebSocket(
  "wss://open-ws.coinglass.com/ws-api?cg-api-key=" + process.env.COINGLASS_API_KEY
);
const upgradeSuffix = " need upgrade plan";
let heartbeat;

ws.onopen = () => {
  ws.send(JSON.stringify({ method: "subscribe", channels: ["liquidation_orders"] }));
  heartbeat = setInterval(() => {
    if (ws.readyState === WebSocket.OPEN) ws.send("ping");
  }, 20000);
};
ws.onclose = () => clearInterval(heartbeat);

ws.onmessage = (event) => {
  const raw = event.data;
  if (raw === "pong") return;
  if (typeof raw !== "string") {
    console.warn("Received a non-text message; ignored.");
    return;
  }
  if (raw.endsWith(upgradeSuffix)) {
    console.warn("Subscription not permitted:", raw.slice(0, -upgradeSuffix.length));
    return;
  }
  let msg;
  try {
    msg = JSON.parse(raw);
  } catch {
    console.warn("Received an unparseable message; ignored.");
    return;
  }
  if (msg && msg.channel === "liquidation_orders") console.log(msg.data);
};
# Install first: pip install websockets
import asyncio
from contextlib import suppress
import json
import os

import websockets

URL = "wss://open-ws.coinglass.com/ws-api?cg-api-key=" + os.environ["COINGLASS_API_KEY"]
UPGRADE_SUFFIX = " need upgrade plan"

async def heartbeat(ws):
    while True:
        await asyncio.sleep(20)
        await ws.send("ping")

async def main():
    async with websockets.connect(URL) as ws:
        await ws.send(json.dumps({"method": "subscribe", "channels": ["liquidation_orders"]}))
        heartbeat_task = asyncio.create_task(heartbeat(ws))
        try:
            async for raw in ws:
                if raw == "pong":
                    continue
                if not isinstance(raw, str):
                    print("Received a non-text message; ignored.")
                    continue
                if raw.endswith(UPGRADE_SUFFIX):
                    print("Subscription not permitted:", raw[:-len(UPGRADE_SUFFIX)])
                    continue
                try:
                    msg = json.loads(raw)
                except json.JSONDecodeError:
                    print("Received an unparseable message; ignored.")
                    continue
                print(msg)
        finally:
            heartbeat_task.cancel()
            with suppress(asyncio.CancelledError):
                await heartbeat_task

asyncio.run(main())
⚠️

Connect from your server

The connection URL contains your API Key. Open the WebSocket connection on your server and forward the data to your frontend; do not connect directly from a web page.

Use Cases

Large Liquidation Alerts

Set a threshold on volume_usd, and when an amount exceeds it, push an alert to work groups on Telegram, Discord, Slack and similar platforms.

Real-Time Liquidation Dashboard

Show the latest liquidation orders in a scrolling feed, and summarize them per minute by exchange, coin and side.

Risk Control and Trading Signals

A chain of liquidations in the same direction within a short time often comes with sharp volatility, and can be used to tighten risk controls or trigger strategies.

Data Storage and Research

Write the pushed data to a database to build up a record of individual liquidations for post-event reviews and backtesting.

API Plans

Only the API plans marked Yes in the table below can call this endpoint. For the price of each plan, see API Plans.

API PlanAccess
Hobbyist❌ No
Startup❌ No
Standard✅ Yes
Professional✅ Yes
Enterprise✅ Yes

Other Channels

ChannelContent
Spot TradesTick-by-tick trades in the spot market
Futures TradesTick-by-tick trades in the futures market
Futures Ticker SnapshotMarket snapshots of futures price, open interest and more

FAQ

How do I recover after a disconnection, and is the data from that period lost?

When a network problem occurs, the connection is closed. Reconnect with gradually increasing intervals of 1, 2 and 4 seconds, and subscribe again once connected; you can use the REST Liquidation Orders endpoint to query data from the last 7 days.

How many connections can one API Key open at the same time?

There is no limit on the number of WebSocket connections.

What do 1 and 2 in the side field mean?

1 is a long liquidation and 2 is a short liquidation.

Learn More: Liquidations and Real-Time Data Push

What Is a Liquidation?

A liquidation is also called a forced close: when the margin in a futures account is no longer enough to maintain a position, the exchange forcibly closes that position. Long liquidations mostly happen during price declines, and short liquidations mostly during price rises.

How Do I Get Real-Time Bitcoin Liquidation Data?

Subscribe to the liquidation_orders channel and filter the received messages for base_asset equal to BTC to get real-time Bitcoin liquidation orders across the whole market; the same works for Ethereum, SOL and other coins.

What Is the Difference Between WebSocket Push and REST Polling?

Polling requires repeated requests that use up your quota, and can miss data between two requests; with WebSocket, the server pushes data as soon as an event happens, with lower latency and fewer requests.

Related Docs