# Coinglass Liquidation Heatmap Scraper (`barefoot_grade/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/barefoot_grade/coinglass-liquidation-scraper.md
- **Developed by:** [Philip Kirkbride](https://apify.com/barefoot_grade) (community)
- **Categories:** Business
- **Stats:** 2 total users, 1 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

### Quick Start

Collect crypto liquidation events and aggregated long/short heatmap totals across major exchanges.
Use it for trading dashboards, market-shock monitoring, and scheduled snapshots of forced-liquidation activity.
Start with this minimal input:

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

Data is public market data; no account or API key is needed.

### 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. Empty = all. |
| `symbols` | array | `[]` | Optional coin watchlist (`"BTC"`, `"btc"`, and `"BTCUSDT"` all select BTC). Empty = every symbol. |
| `minUsd` | number | `0` | Keep only liquidation events of at least this USD size. |
| `maxEvents` | integer | `2000` | Maximum events collected per run (100–5000). |
| `alertUsd` | number | `0` | When > 0, every event at or above this USD size sends one Telegram alert. `0` disables alerts. |
| `telegramBotToken` | string | empty | Secret bot token for alerts; falls back to the `TELEGRAM_BOT_TOKEN` environment variable. |
| `telegramChatId` | string | empty | Chat that receives the alerts. |
| `requestDelaySecs` | number | `0.3` | Pause between paged requests. |

### Output

The dataset has two record kinds. `liquidation_event` rows carry `recordKey`, `source`, `kind`, `exchange`, `symbol`, `pair`, `side` (`long`/`short`), `window`, `valueUsd`, `quantity`, `price`, `eventTime`, `sourceUrl`, and `collectedAt`. `liquidation_bucket` rows aggregate per exchange and side: `valueUsd`, `quantity`, `eventCount`, and `coveredSeconds`.

The run summary (KeyValue store `OUTPUT`) reports counts, coverage, the alert report, and any warnings. `records` counts only the rows stored in the dataset; if your maximum charge per run stops the run early, `stoppedBy` is `chargeLimit` and the summary line says how many records 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"}
```

### FAQ

**How fresh is the data?** Each run reads the live feed. The feed retains roughly the last 2–3 hours of events; a wider window reports the span actually covered via `coveredSeconds`.

**Which exchanges are covered?** Major futures exchanges including Binance, OKX, Bybit, Bitget, Gate, HTX, Hyperliquid, and others. Filter with `exchanges` if you need a subset.

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

**What happens on partial data?** Unavailable values are returned as explicit `null`, never guessed, and problems are listed in the run warnings. A failed alert send is a warning, not a failed run.

### Price

**$0.0015 per result row**, the same for a liquidation event row and an exchange total row, plus **$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 are charged only for result rows that are actually saved to the dataset; if fetching or validation fails, no rows are saved and none are charged. Platform usage is included in these prices.

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,
  "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("barefoot_grade/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("barefoot_grade/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 barefoot_grade/coinglass-liquidation-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,barefoot_grade/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/iTmSLGj1kOimEjzOs/openapi.json
