# Live Order Book Heatmap & Order Flow (`gleaming_carp/orderbook-heatmap-live`) Actor

Live liquidity heatmap, CVD, book imbalance and liquidations from Binance, Bybit, OKX and BingX in one run. Pay per minute recorded.

- **URL**: https://apify.com/gleaming_carp/orderbook-heatmap-live.md
- **Developed by:** [LatAm Data Tools](https://apify.com/gleaming_carp) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 snapshot minutes

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

## Live Order Book Heatmap & Order Flow

Record **live crypto order books, trades and liquidations** for any USDT pair on **Binance, Bybit, OKX or BingX** for 1 to 30 minutes, and get:

1. A **liquidity heatmap (PNG)**: resting limit orders over time, last-price line, big trades as bubbles, long/short liquidations, the current book profile and the biggest walls, plus taker volume delta and CVD underneath.
2. **One dataset row per minute** with CVD, order book imbalance (±0.1 / 0.5 / 1 %), spread, bid/ask depth, long and short liquidations, biggest bid and ask walls, the largest trade, and a per-exchange breakdown.
3. A short **JSON summary** (key `OUTPUT`) with totals and the status of every exchange connection.

![Sample heatmap: BTCUSDT, Binance + Bybit, 1 minute](https://api.apify.com/v2/key-value-stores/Iz0jEjWXc8Q6kc1kN/records/sample-heatmap-btcusdt.png)

No API keys, no accounts, no proxies: the Actor connects at run time to the exchanges' **free public websocket and REST market-data APIs**, records for the time you choose, and computes everything on the fly.

### What can I use it for?

- See where large resting liquidity ("walls") sits around the price right now, and how it moves.
- Measure order-flow pressure: taker buy vs. sell volume, CVD and book imbalance per minute.
- Track liquidations (longs vs. shorts) across exchanges during a volatile window.
- Feed AI agents, dashboards, bots or research notebooks with a clean, compact market microstructure snapshot.
- Schedule it (e.g. every hour for 1 minute) to build your own order-flow history.

### Input

| Field | Default | Description |
|---|---|---|
| `symbol` | `BTCUSDT` | USDT pair. `BTC-USDT`, `BTC/USDT`, `BTC-USDT-SWAP` also work. |
| `exchanges` | `["binance","bybit"]` | Any of `binance`, `bybit`, `okx`, `bingx`. |
| `durationMinutes` | `1` | 1-30 minutes of live recording. One `snapshot` event per minute. |
| `depthLevels` | `1000` | Book levels per side (each exchange gives what it supports). |
| `priceBucket` | auto | Price bucket size for the heatmap and walls (auto ≈ 0.006 % of price, e.g. 5 USD for BTC). |
| `priceRangePct` | auto | Heatmap vertical range, ± % of the price. |
| `bigTradeMinUsd` | auto | Big-trade threshold (auto = 99.5th percentile, at least 10,000 USD). |
| `sampleIntervalSec` | `1` | How often books are sampled. |
| `autoFallback` | `true` | Add a reachable exchange if the selected ones are blocked (see below). |

Example:

```json
{ "symbol": "ETHUSDT", "exchanges": ["bybit", "okx"], "durationMinutes": 5 }
```

### Output

#### Dataset (one row per minute)

```json
{
  "type": "minute", "minute_index": 1, "symbol": "BTCUSDT",
  "start_utc": "2026-10-26T20:42:47.000Z", "end_utc": "2026-10-26T20:43:47.000Z",
  "price_open": 79817.2, "price_high": 79817.3, "price_low": 79816.8, "price_close": 79816.9,
  "taker_buy_usd": 467438.2, "taker_sell_usd": 1324251.78, "volume_delta": -10.73, "cvd": -10.73,
  "spread_bps_avg": 0.02, "book_imbalance_0_1pct": 0.02, "book_imbalance_0_5pct": -0.0116,
  "bid_depth_usd_0_5pct": 951442829.6, "ask_depth_usd_0_5pct": 971026520.9,
  "liq_long_usd": 13489.11, "liq_short_usd": 0, "liq_count": 2,
  "big_trades_count": 3,
  "largest_trade": { "price": 79817.2, "usd": 305620.06, "taker_side": "sell", "exchange": "binance" },
  "biggest_bid_wall": { "price_from": 79675, "price_to": 79680, "size": 30.5, "usd": 2430000, "distance_pct": -0.17, "by_exchange": { "binance": 11.6, "bybit": 18.9 } },
  "biggest_ask_wall": { "price_from": 79940, "price_to": 79945, "size": 27.4, "usd": 2190000, "distance_pct": 0.16 },
  "per_exchange": { "binance": { "spread_bps_avg": 0.0125, "book_imbalance_0_5pct": 0.138, "cvd": -9.53 }, "bybit": { } },
  "heatmap_url": "https://api.apify.com/v2/key-value-stores/.../records/heatmap.png"
}
```

#### Key-value store

- `heatmap.png`: the heatmap image.
- `OUTPUT`: JSON summary (totals, CVD, liquidations, top walls, and `exchanges_status` with how each exchange was reached, or why it was not).

### Exchanges and data sources

| Exchange | Order book | Trades | Liquidations |
|---|---|---|---|
| Binance USD-M futures | REST snapshot (1000) + websocket diff stream | websocket `aggTrade` | websocket `forceOrder` |
| Bybit USDT perpetual | websocket `orderbook.50/200/1000` | websocket `publicTrade` | websocket `allLiquidation` |
| OKX USDT swap | websocket `books` (400) or REST `books-full` (up to 5000) | websocket `trades` | websocket `liquidation-orders` |
| BingX USDT perpetual | REST depth (1000) every second | REST trades | not available |
| Binance spot (fallback only) | Binance market-data endpoints (`data-api` / `data-stream.binance.vision`) | websocket `aggTrade` | n/a (spot) |

**Server location note.** Apify runs in the United States, and some exchanges restrict US IP addresses. Tested on Apify (October 2026): **Bybit, OKX and BingX work fully**. **Binance USD-M futures** streams (book diffs, trades, liquidations) work, but its REST depth snapshot answers HTTP 451 from US servers, so the Binance book is built from the live diff stream only: levels appear as soon as they change, and the Actor waits a few extra seconds before recording so the book fills up. Nothing is routed around the restriction (no proxies). If the selected exchanges deliver nothing, `autoFallback` adds Bybit, OKX or BingX, and if Binance futures is unreachable it adds Binance spot through Binance's official market-data endpoints.
The `OUTPUT` record always tells you which exchanges delivered data, and minutes without any book data are not charged.

Notes:

- Contract sizes are converted to the base asset (e.g. OKX contracts → BTC).
- Each exchange's book is normalized to its own typical size for the heatmap colors, so a deep exchange does not hide the others. Walls and depth numbers in the dataset are absolute (base asset and USD).
- BingX publishes very large, evenly spaced ladders that can dominate "biggest wall" figures when it is selected.
- Liquidation feeds are what each exchange publishes (Binance sends at most one liquidation per symbol per second).
- Stop/stop-loss orders are not visible in any public order book.

### Pricing

Pay per event: one **`snapshot`** event per recorded minute (with order book data). Platform usage is included. A default 1-minute run is one event.

### Disclaimer

Data comes from public exchange market-data feeds and is provided for research, monitoring and visualization only. It is not investment advice and makes no recommendation to buy or sell anything. Check each exchange's terms if you redistribute the data.

### Disclaimer

This Actor is an independent tool and is not affiliated with, endorsed by or sponsored by Binance, Bybit, OKX, BingX or any charting software vendor. All product and company names are trademarks of their respective owners and are used only to describe which public websites the Actor reads.

# Actor input Schema

## `symbol` (type: `string`):

USDT-margined pair, e.g. BTCUSDT, ETHUSDT, SOLUSDT. Formats like BTC-USDT, BTC/USDT or BTC-USDT-SWAP are accepted.

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

Exchanges to stream live (USDT perpetual futures). Binance USD-M futures may be geo-blocked on the server: the Actor then adds Binance spot through Binance's official market-data endpoints and/or another exchange (see 'Automatic fallback').

## `durationMinutes` (type: `integer`):

How long to record live data. You are charged one 'snapshot' event per recorded minute.

## `depthLevels` (type: `integer`):

Price levels per side to use from each book. Each exchange delivers what it supports: Bybit 50/200/1000, OKX 400 by websocket or up to 5000 by REST, Binance 1000 snapshot plus live diffs, BingX up to 1000.

## `priceBucket` (type: `string`):

Group resting liquidity into price buckets of this size in quote currency (e.g. 5 for BTC, 0.1 for ETH). Leave empty for automatic (about 0.006% of the price).

## `priceRangePct` (type: `string`):

Vertical range of the heatmap around the price, e.g. 0.3 = ±0.3%. Leave empty for automatic (±0.15% for 1 minute, wider for longer runs, limited to what the books cover).

## `bigTradeMinUsd` (type: `integer`):

Trades at or above this notional are drawn as bubbles and counted as big trades. 0 = automatic (99.5th percentile of trade sizes, at least 10,000 USD).

## `sampleIntervalSec` (type: `integer`):

How often the order books are sampled into the heatmap and metrics.

## `autoFallback` (type: `boolean`):

If none of the selected exchanges is reachable, add Bybit, OKX or BingX automatically; if Binance futures is blocked, add Binance spot via its official market-data endpoints. Recommended.

## Actor input object example

```json
{
  "symbol": "BTCUSDT",
  "exchanges": [
    "binance",
    "bybit"
  ],
  "durationMinutes": 1,
  "depthLevels": 1000,
  "bigTradeMinUsd": 0,
  "sampleIntervalSec": 1,
  "autoFallback": true
}
```

# Actor output Schema

## `heatmap` (type: `string`):

Bookmap-style heatmap of resting liquidity with price, big trades and liquidations.

## `minutes` (type: `string`):

One dataset row per recorded minute.

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

Run summary: exchanges status, totals, CVD, liquidations, walls.

# 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 = {
    "symbol": "BTCUSDT",
    "exchanges": [
        "binance",
        "bybit"
    ],
    "durationMinutes": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("gleaming_carp/orderbook-heatmap-live").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 = {
    "symbol": "BTCUSDT",
    "exchanges": [
        "binance",
        "bybit",
    ],
    "durationMinutes": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("gleaming_carp/orderbook-heatmap-live").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 '{
  "symbol": "BTCUSDT",
  "exchanges": [
    "binance",
    "bybit"
  ],
  "durationMinutes": 1
}' |
apify call gleaming_carp/orderbook-heatmap-live --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gleaming_carp/orderbook-heatmap-live"
        }
    }
}
```

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/LAakdBns2wIMn0gdh/builds/XpryvusmGHE3iIAsD/openapi.json
