# Coinglass Liquidation Heatmap Scraper (`automatic/coinglass-liquidation-scraper`) Actor

Crypto liquidation data from Coinglass: per-event liquidations (exchange, symbol, side, USD size, price, time) over 1h/4h/12h/24h windows with exchange, symbol and threshold filters, plus per-exchange long/short heatmap buckets. Optional Telegram alerts. Snapshot per run.

- **URL**: https://apify.com/automatic/coinglass-liquidation-scraper.md
- **Developed by:** [Philip Kirkbride](https://apify.com/automatic) (community)
- **Categories:** Business
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 result rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Coinglass Liquidation Heatmap Scraper

Collect crypto futures liquidations from Coinglass: one row per forced
liquidation (exchange, coin, pair, long or short, USD size, price, time) plus
long/short totals per exchange and market-wide for the same window. Built for
traders, quant hobbyists and bot builders who schedule runs and feed the JSON
into dashboards, alerts or models. No account or API key is needed.

Data only, not financial advice.

### Use cases

- **Liquidation dashboards:** chart long vs short liquidations per exchange,
  refreshed every hour on a schedule.
- **Market-shock alerts:** get a Telegram message when a single liquidation
  above your USD threshold hits (for example $1M+ BTC longs).
- **Squeeze research:** compare long and short totals across Binance, OKX,
  Bybit, Hyperliquid and others around big price moves.
- **Model features:** store hourly snapshots and use liquidation volume and
  side balance as inputs to your own backtests.

### Quick start

1. Open the Actor and click **Start**. The form is prefilled with a 1-hour
   window, every exchange, every coin and no size floor.
2. Read the rows in the **Output** tab, or export them as JSON, CSV or Excel.

To keep only the larger events, start from this input:

```json
{"timeWindow": "1h", "minUsd": 10000}
```

An empty input (`{}`) runs the same defaults as the prefilled form: a 1-hour
window across all exchanges and coins, up to 2,000 events.

### Input

| Name | Type | Default | What it does |
| --- | --- | --- | --- |
| `timeWindow` | string | `1h` | Lookback window: `1h`, `4h`, `12h` or `24h`. |
| `exchanges` | array | `[]` | Optional exchange allow-list (e.g. `["Binance", "OKX"]`), case-insensitive, up to 20. Empty = all. |
| `symbols` | array | `[]` | Optional coin watchlist, up to 100 (`"BTC"`, `"btc"` and `"BTCUSDT"` all select BTC). Empty = every coin. |
| `minUsd` | number | `0` | Keep only liquidations of at least this USD size. Totals are computed from the kept events. |
| `maxEvents` | integer | `2000` | Maximum events collected per run (100–5,000). |
| `alertUsd` | number | `0` | When above 0, each liquidation at or above this USD size (long or short) sends one Telegram message, largest first, up to 25 per run. `0` turns alerts off. |
| `telegramBotToken` | string | empty | Secret bot token for alerts; if empty, the `TELEGRAM_BOT_TOKEN` secret environment variable is used. |
| `telegramChatId` | string | empty | Chat that receives the alerts. |
| `requestDelaySecs` | number | `0.3` | Pause between pages of results (0–10 seconds). |

A misspelt input field stops the run with an error that names it, so a typo
never silently returns an unfiltered board.

### Output

The dataset has two record kinds:

- `liquidation_event`: `recordKey`, `source`, `kind`, `exchange`, `symbol`,
  `pair`, `side` (`long`/`short`), `window`, `valueUsd`, `quantity`, `price`,
  `eventTime`, `sourceUrl`, `collectedAt`.
- `liquidation_bucket`: one row per exchange and side, plus an `All` row per
  side for the whole market, with `valueUsd`, `quantity`, `eventCount` and
  `coveredSeconds` (the time span the events actually cover).

Fields that don't apply to a kind are `null`. The run summary (key-value store
`OUTPUT`) reports counts, coverage, the alert report and any warnings.
`records` counts only rows saved to the dataset; if your maximum charge per run
stops the run early, `stoppedBy` is `chargeLimit` and the status message says
how many rows were stored.

### Output example

Real records from a run with the quick-start input: one liquidation event and
the all-exchange long total for the same window.

```jsonl
{"recordKey":"liq:Binance:DOGE:1792562507111:long:30055.6","source":"coinglass-capi","kind":"liquidation_event","exchange":"Binance","symbol":"DOGE","pair":"DOGEUSDT","side":"long","window":"1h","valueUsd":30055.6362,"quantity":369870,"price":0.08126,"eventCount":null,"eventTime":"2026-10-21T06:01:47.111000+00:00","coveredSeconds":null,"sourceUrl":"https://www.coinglass.com/LiquidationData","collectedAt":"2026-10-21T06:06:58.889263+00:00"}
{"recordKey":"liq-bucket:All:long:1h","source":"coinglass-capi","kind":"liquidation_bucket","exchange":"All","symbol":null,"pair":null,"side":"long","window":"1h","valueUsd":987002.19,"quantity":5128779.99567,"price":null,"eventCount":27,"eventTime":null,"coveredSeconds":2725,"sourceUrl":"https://www.coinglass.com/LiquidationData","collectedAt":"2026-10-21T06:06:58.889263+00:00"}
```

### Pricing

- **$0.0015 per result row**, the same for a liquidation event row and a
  total row.
- **$0.005 per run start.** The run-start event is charged per GB of memory;
  the default 512 MB run is one start event. The start is charged even if the
  run saves no rows.

You pay only for rows actually saved to the dataset; if fetching or validation
fails, no rows are saved and none are charged. Platform usage is included.

Worked cost: a run that saves 180 events and 20 total rows (200 rows) costs
$0.005 + 200 × $0.0015 = **$0.305**. 1,000 rows cost **$1.50** plus the start.
Raise `minUsd` or narrow `exchanges`/`symbols` to keep runs small; set a
maximum charge per run to cap spend.

### Scheduling and monitoring

- Schedule the Actor every hour with `timeWindow: "1h"` for a continuous
  feed. `recordKey` is stable for the same liquidation, so de-duplicate on it
  when consecutive windows overlap.
- For alert-only use, set `alertUsd` high (for example `1000000`) together
  with `telegramChatId` and the bot token. A failed or skipped send is a
  warning in `OUTPUT`, never a failed run.

### FAQ

**How fresh is the data?** Each run reads the live liquidation feed at run
time; nothing is cached between runs.

**Why does a 24h window cover less than 24 hours?** The source keeps roughly
the last 2–3 hours of individual events. A wider window returns what is
available and reports the span it covered in `coveredSeconds` and a warning.

**Which exchanges are covered?** Major futures exchanges including Binance,
OKX, Bybit, Bitget, Gate, HTX, Hyperliquid, BitMEX and others. Filter with
`exchanges` for a subset; a filter entry with no events in the window is
listed in the warnings.

**Is there a minimum event size?** The source itself lists events from roughly
$1,000 upward; raise the floor with `minUsd`.

**What happens on partial data?** Unavailable values are explicit `null`,
never guessed, and problems are listed in the run warnings.

**Export formats?** JSON, CSV, Excel, XML or RSS from the dataset, or read it
through the Apify API in your own pipeline.

### Limits

- A snapshot of the recent liquidation feed, not a full historical archive.
- Up to 5,000 events per run (`maxEvents`).
- Totals are computed from the events collected in this run after your
  filters, not from a separate all-time source.

For support, contact Apify support and include the Actor run ID.

# Actor input Schema

## `exchanges` (type: `array`):

Optional exchange allow-list (case-insensitive: Binance, OKX, Bybit, Bitget, Gate, HTX, Hyperliquid, Bitmex, Aster, Lighter ...). Empty = all exchanges.

## `symbols` (type: `array`):

Optional symbol watchlist (case-insensitive; 'BTC', 'btc' and 'BTCUSDT' all select BTC). Empty = every symbol.

## `timeWindow` (type: `string`):

Lookback window for the event feed. The feed retains roughly the last 2-3h of events server-side; a wider window reports the span actually covered in the run summary.

## `minUsd` (type: `number`):

Optional minimum liquidation size in USD (the feed's own collector floor is ~$1k per event).

## `maxEvents` (type: `integer`):

Upper bound on collected events per run (bounds the paged walk; the feed pages 1000 rows at a time).

## `alertUsd` (type: `number`):

When > 0, every liquidation event at or above this USD size sends one inline Telegram alert ('🚨 BTC long liquidation ~$900k at 2486 (Binance)'). Symmetric: large long and short liquidations both alert. 0 (the default) disables alerts entirely.

## `telegramBotToken` (type: `string`):

Bot token for the liquidation alerts — a secret: never share runs or datasets that expose it. Falls back to the TELEGRAM_BOT_TOKEN secret environment variable when empty. Never printed; masked in any warning line.

## `telegramChatId` (type: `string`):

Telegram chat id for the liquidation alerts. With telegramBotToken (or TELEGRAM_BOT_TOKEN) and alertUsd > 0, each threshold-clearing event sends one inline message (largest first, budget 25 per run). A failed or skipped send is a warning, never a failed run.

## `requestDelaySecs` (type: `number`):

Polite pause between the paged feed requests.

## Actor input object example

```json
{
  "exchanges": [],
  "symbols": [],
  "timeWindow": "1h",
  "minUsd": 0,
  "maxEvents": 2000,
  "alertUsd": 0,
  "telegramBotToken": "",
  "telegramChatId": "",
  "requestDelaySecs": 0.3
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "exchanges": [],
    "symbols": [],
    "timeWindow": "1h",
    "minUsd": 0,
    "maxEvents": 2000,
    "alertUsd": 0,
    "telegramBotToken": "",
    "telegramChatId": "",
    "requestDelaySecs": 0.3
};

// Run the Actor and wait for it to finish
const run = await client.actor("automatic/coinglass-liquidation-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "exchanges": [],
    "symbols": [],
    "timeWindow": "1h",
    "minUsd": 0,
    "maxEvents": 2000,
    "alertUsd": 0,
    "telegramBotToken": "",
    "telegramChatId": "",
    "requestDelaySecs": 0.3,
}

# Run the Actor and wait for it to finish
run = client.actor("automatic/coinglass-liquidation-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "exchanges": [],
  "symbols": [],
  "timeWindow": "1h",
  "minUsd": 0,
  "maxEvents": 2000,
  "alertUsd": 0,
  "telegramBotToken": "",
  "telegramChatId": "",
  "requestDelaySecs": 0.3
}' |
apify call automatic/coinglass-liquidation-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,automatic/coinglass-liquidation-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/LMXRl5jk42bjfb1hZ/builds/yau8yagSjNJXq6r4Q/openapi.json
