# Binance Market Scraper: Tickers, Klines & Order Book (`arman-bd/binance-market-data-scraper`) Actor

Scrape Binance public market endpoints: 24h tickers, OHLCV klines, order-book depth and recent trades across every listed pair. Exchange-grade data with no authentication.

- **URL**: https://apify.com/arman-bd/binance-market-data-scraper.md
- **Developed by:** [Arman Hossain](https://apify.com/arman-bd) (community)
- **Categories:** Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.37 / 1,000 data scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Binance Market Scraper: Tickers, Klines & Order Book

![Binance Market Scraper: Tickers, candles, order-book depth and recent trades for any spot pair, one record per symbol](https://api.apify.com/v2/key-value-stores/ZQOcNAOHrIgTacAmy/records/binance-market-data-scraper.jpg)

**Binance Market Scraper** pulls exchange-grade market data straight from Binance's public spot REST API: the 24-hour ticker rollup for any listed pair, OHLCV candles at any interval from 1 second to 1 month, live order-book depth, and the most recent public trades.

Give it a list of symbols and it returns **one structured record per symbol**. Every record always carries the 24h ticker, last price, change, high/low, base and quote volume, trade count, and the data type you pick is attached on top. No credentials to manage.

**Agent skill: [SKILL.md](https://api.apify.com/v2/key-value-stores/t7YoTxpZEJOWvw4Ug/records/binance-market-data-scraper.md)**

```
https://api.apify.com/v2/key-value-stores/t7YoTxpZEJOWvw4Ug/records/binance-market-data-scraper.md
```

### What you get

- **One record per symbol**, with the 24-hour ticker always on it: last price, absolute and percentage change, weighted average, high and low, base and quote volume, trade count and the window's open and close times.
- **The data type you ask for, attached to that same record** — OHLCV candles at any interval from one second to one month, live order-book depth, or the most recent public trades — so a multi-symbol run is one table rather than a join.
- **Numbers as numbers.** Prices, volumes and percentages arrive parsed rather than as the strings the exchange sends, and every timestamp is ISO 8601 UTC.
- **A `RUN_SUMMARY`** recording the symbols requested, what each returned, the request weight used against the exchange's budget, and any symbol that failed with its reason.
- **No credentials to manage** — public spot market data only.

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `symbols` | array | `["BTCUSDT","ETHUSDT"]` | Binance spot symbols. Separators are stripped, so `BTC/USDT`, `btc-usdt` and `BTCUSDT` are all the same input. |
| `dataType` | string | `ticker` | `ticker`, `klines`, `depth` or `trades`. Decides what gets attached to each record. |
| `interval` | string | `1h` | Candle size: `1s`, `1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`, `4h`, `6h`, `8h`, `12h`, `1d`, `3d`, `1w`, `1M`. Only used by `klines`. |
| `limit` | integer | `100` | Rows per symbol. Capped at 1000 for `klines` and `trades`, 5000 for `depth`. Ignored by `ticker`. |
| `startTime` | string | - | Fetch candles from this point forward. ISO date (`2026-01-01`) or an epoch timestamp in seconds or milliseconds. Only applies to `klines`. |

**Which combinations make sense**

- `dataType: "ticker"` ignores `interval`, `limit` and `startTime`. It is one request per symbol and the cheapest sweep.
- `interval` and `startTime` only mean anything with `dataType: "klines"`. `startTime` is silently ignored (with a warning in the log) for the other types.
- `limit: 5000` is only accepted for `depth`; klines and trades cap at 1000 per request.
- Order books and trades are point-in-time snapshots. For a time series, schedule the Actor rather than raising `limit`.

```json
{
 "symbols": ["BTCUSDT", "ETHUSDT", "SOLUSDT"],
 "dataType": "klines",
 "interval": "1h",
 "limit": 500,
 "startTime": "2026-08-01"
}
```

### Output

One dataset item per symbol. Prices, volumes and percentages are numbers, not the strings Binance sends; timestamps are ISO 8601.

```json
{
 "symbol": "BTCUSDT",
 "lastPrice": 64584.01,
 "priceChange": 501.09,
 "priceChangePercent": 0.782,
 "weightedAvgPrice": 64616.58408739,
 "highPrice": 65025.22,
 "lowPrice": 63880,
 "volume": 12407.52427,
 "quoteVolume": 801731835.3088007,
 "openTime": "2026-08-05T11:29:41.001Z",
 "closeTime": "2026-08-06T11:29:41.001Z",
 "tradeCount": 2314415,
 "bids": null,
 "asks": null,
 "klines": [
 {
 "openTime": "2026-08-01T00:00:00.000Z",
 "open": 62887.88,
 "high": 63024.04,
 "low": 62887.87,
 "close": 62938.01,
 "volume": 517.26897,
 "closeTime": "2026-08-01T00:59:59.999Z",
 "quoteVolume": 32568037.4802799,
 "tradeCount": 40193,
 "takerBuyVolume": 232.52413,
 "takerBuyQuoteVolume": 14639741.9602915
 }
 ],
 "trades": null,
 "scrapedAt": "2026-08-06T11:29:41.480Z"
}
```

| Field | Meaning |
|---|---|
| `symbol` | Binance symbol as the exchange reports it |
| `lastPrice` | Most recent trade price |
| `priceChange`, `priceChangePercent` | Absolute and percentage move over the rolling 24h window |
| `weightedAvgPrice` | Volume-weighted average price for the window |
| `highPrice`, `lowPrice` | 24h high and low |
| `volume`, `quoteVolume` | Base-asset and quote-asset volume over the window |
| `openTime`, `closeTime` | Start and end of the rolling 24h window (ISO 8601) |
| `tradeCount` | Number of trades in the window |
| `bids`, `asks` | Order-book levels as `{ price, qty }`, best first, populated when `dataType: "depth"`, otherwise `null` |
| `klines` | OHLCV candles, oldest first, populated when `dataType: "klines"`, otherwise `null` |
| `trades` | Recent public trades as `{ id, price, qty, quoteQty, time, isBuyerMaker }`, populated when `dataType: "trades"`, otherwise `null` |
| `scrapedAt` | Run timestamp |

A `RUN_SUMMARY` record in the key-value store holds the run's counts, the mirror used, the peak request weight and every symbol that failed:

```json
{
 "host": "https://api.binance.com",
 "dataType": "klines",
 "symbolsRequested": 4,
 "symbolsFailed": 1,
 "failures": [
 { "symbol": "NOPEUSDT", "error": "rejected by Binance: Invalid symbol. (code -1121)" }
 ],
 "seriesSaved": 3,
 "peakRequestWeight": 14,
 "requestWeightLimit": 6000,
 "filters": {
 "symbols": ["BTCUSDT", "ETHUSDT", "SOLUSDT", "NOPEUSDT"],
 "dataType": "klines",
 "interval": "1h",
 "limit": 5,
 "startTime": "2026-08-01T00:00:00.000Z"
 },
 "finishedAt": "2026-08-06T11:29:43.255Z"
}
```

### Use cases

**Backtest strategies on free OHLCV history.** Pull daily candles from a fixed start date across your universe, then diff on `openTime` for incremental updates.

```json
{
 "symbols": ["BTCUSDT", "ETHUSDT", "SOLUSDT", "BNBUSDT"],
 "dataType": "klines",
 "interval": "1d",
 "limit": 1000,
 "startTime": "2024-01-01"
}
```

**Monitor spreads and liquidity.** Snapshot the top of book on a schedule; the best bid/ask spread and the depth at each level fall straight out of `bids[0]` and `asks[0]`.

```json
{
 "symbols": ["BTCUSDT", "ETHUSDT"],
 "dataType": "depth",
 "limit": 50
}
```

**Feed a trading dashboard.** The ticker sweep is one request per symbol and returns everything a price panel needs.

```json
{
 "symbols": ["BTCUSDT", "ETHUSDT", "SOLUSDT", "XRPUSDT", "ADAUSDT"],
 "dataType": "ticker"
}
```

### Limits and behaviour

- **Request weight is read, not guessed.** Every response carries `X-MBX-USED-WEIGHT-1M`; the Actor tracks it, pauses 60 seconds if it climbs past 4800 of the 6000/minute budget, and reports the run's peak in `RUN_SUMMARY.peakRequestWeight`. In practice a 5-symbol kline run peaks around 20.
- **A bad symbol never aborts the run.** Binance answers HTTP 400 with `code -1121` for an unknown symbol; that symbol is recorded in `RUN_SUMMARY.failures` and the run continues. The Actor only throws when *every* symbol fails.
- **Transient errors are retried.** 418, 429 and 5xx get three attempts with linear backoff, and each attempt walks the mirror list, so a single unhealthy host does not stall the run.
- **Host failover is automatic.** HTTP 451 or 403 on one host moves to the next mirror without burning a retry.
- **Symbols are normalised, not validated locally.** `BTC/USDT` becomes `BTCUSDT`; whether that pair exists is Binance's answer, not a guess.
- **Requests are paced** at ~120 ms between symbols, which is polite and far below any published limit.
- **Public data only.** No authentication, no personal data, no access-control bypass.

### FAQ

**Do I need a proxy?** No. Proxy configuration is not required to run this Actor.

**Do I need a Binance account or API key?** No. You supply no credentials.

**What happens if a source is unavailable?** It is reported in `RUN_SUMMARY.failures` and the run continues with the remaining symbols.

**Can I schedule it?** Yes, that is the intended use. Sub-second endpoints and a small request-weight footprint make minute-level polling comfortable.

**How far back does kline history go?** To the pair's listing date. Set `startTime` and raise `limit`; each run returns up to 1000 candles per symbol, so walk forward across runs for deeper history.

**Why is `klines` null in my records?** Because `dataType` was not `klines`. Each record populates exactly one of `klines`, `bids`/`asks` or `trades`, the field for the type you asked for.

**Is this spot or futures?** Spot (`/api/v3`). Futures live on a different host and are not covered.

**Can I integrate it with something else?** Yes, Apify API, client libraries, webhooks, scheduled runs, dataset exports (JSON/CSV/Excel) or MCP. Output is structured JSON.

# Actor input Schema

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

Binance spot symbols, e.g. BTCUSDT. Separators are stripped, so BTC/USDT and btc-usdt work too. Leave empty to default to BTCUSDT and ETHUSDT.

## `dataType` (type: `string`):

What to attach to each symbol's record. 'ticker' is the 24h rollup only; the others add OHLCV candles, order-book levels or recent trades.

## `interval` (type: `string`):

Candle size. Only used when Data type is 'klines'.

## `limit` (type: `integer`):

How many klines, order-book levels or trades to pull per symbol. Capped at 1000 for klines and trades, 5000 for depth. Ignored for 'ticker'.

## `startTime` (type: `string`):

Fetch klines from this point forward. ISO date ('2026-01-01') or an epoch timestamp in seconds or milliseconds. Only applies to 'klines'; leave empty for the most recent candles.

## Actor input object example

```json
{
  "symbols": [
    "BTCUSDT",
    "ETHUSDT",
    "SOLUSDT"
  ],
  "dataType": "ticker",
  "interval": "1h",
  "limit": 100,
  "startTime": "2026-01-01"
}
```

# Actor output Schema

## `items` (type: `string`):

Every record the run produced.

## `runsummary` (type: `string`):

The RUN\_SUMMARY record from the run's key-value store.

# 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 = {
    "symbols": [
        "BTCUSDT",
        "ETHUSDT"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("arman-bd/binance-market-data-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 = { "symbols": [
        "BTCUSDT",
        "ETHUSDT",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("arman-bd/binance-market-data-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 '{
  "symbols": [
    "BTCUSDT",
    "ETHUSDT"
  ]
}' |
apify call arman-bd/binance-market-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,arman-bd/binance-market-data-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/QPhBryQUiEvE0PWuh/builds/RFMkWmi3FZfK8j2Kj/openapi.json
