# Crypto Market Data API - Kaiko OHLCV, Trades, Order Books (`nabeelbaghoor/crypto-ohlcv-trades-order-book-api`) Actor

Crypto market data API: OHLCV and VWAP candles, tick trades, order book depth, slippage and spread, liquidations, fair market value prices, reference rates, funding rates, open interest and greeks from Kaiko across 100+ CEX and DEX exchanges. Bring your own API key.

- **URL**: https://apify.com/nabeelbaghoor/crypto-ohlcv-trades-order-book-api.md
- **Developed by:** [Nabeel Hassan](https://apify.com/nabeelbaghoor) (community)
- **Categories:** Developer tools, Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 candle or derivatives price returneds

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

## Crypto Market Data API - Kaiko OHLCV, Trades, Order Books

Export institutional-grade crypto market data from the Kaiko API into an Apify dataset with your own Kaiko API key: OHLCV and VWAP candles, tick-level trades, order book depth and slippage, liquidations, fair market value prices, reference rates and derivatives metrics across 100+ centralised and decentralised exchanges.

This actor wraps the Kaiko REST API. It turns a list of exchange and instrument codes, asset pairs or index tickers into clean, deduplicated rows you can download as JSON, CSV or Excel, schedule on a timer, or feed into trading models, risk dashboards, spreadsheets, data warehouses and AI agents. Bring your own API key.

### What it does

- **OHLCV candles**: open, high, low, close and volume for any spot, future, perpetual future or option instrument on any Kaiko exchange, at any interval from 1 second to 1 day.
- **OHLCV with VWAP and trade count**: the same candles plus the volume weighted average price and the number of trades.
- **Tick-level trades**: every trade with price, amount, trade ID and taker side (buy or sell), for CEX and DEX markets.
- **Order book market depth**: bid and ask volume within 0.1 to 10 percent of the best price, per order book snapshot.
- **Order book price slippage**: the percentage slippage of a market buy and sell order of a size you choose, per snapshot.
- **Order book aggregation**: bid ask spread, mid price, depth and slippage averaged over an interval.
- **Derivative liquidations**: each liquidation on futures and perpetual futures, with price, amounts in base, quote and USD, and the long or short side.
- **Liquidation volumes per asset**: hourly or daily long and short liquidation totals in USD, with a breakdown per exchange.
- **Fair market value prices**: Kaiko direct price (robust weighted median of one pair across exchanges) and synthetic price (built through the most liquid conversion paths), with optional confidence intervals and the stress market indicator.
- **Reference rates**: history of Kaiko benchmark rates such as KK_BRR_BTCUSD, with optional composition and partition detail.
- **Derivatives data**: mark, index and last price; open interest, funding rate, predicted funding rate, implied volatility and option greeks; and contract details (contract size, listing, expiry, strike).
- **Reference codes**: every asset, exchange and instrument Kaiko covers, with first and last trade time and trade count per instrument.
- **Pay only for results**: a request the provider has nothing for becomes a free row that says why, never a charge.

### Input

| Field | Used by | What it does |
| --- | --- | --- |
| `mode` | all | `ohlcv` (default), `countOhlcvVwap`, `trades`, `marketDepth`, `priceSlippage`, `orderBookAggregation`, `liquidations`, `liquidationVolumes`, `directPrice`, `syntheticPrice`, `referenceRate`, `derivativesPrice`, `derivativesRisk`, `derivativesContracts`, `assets`, `exchanges` or `instruments` |
| `instruments` | candle, trade, order book, liquidation and derivatives modes | `exchange:instrument` lines such as `cbse:btc-usd`, or `exchange:class:instrument` such as `binc:perpetual-future:btc-usdt` |
| `instrumentClass` | instrument modes, contract details, instruments | `spot` (default), `future`, `perpetual-future` or `option` |
| `pairs` | direct and synthetic price | `btc-usd`, `eth-eur` |
| `assets` | liquidation volumes | `btc`, `eth` |
| `indexCodes` | reference rates | `KK_BRR_BTCUSD` |
| `startTime`, `endTime` | dated modes | `YYYY-MM-DD` or a UTC time; the end is exclusive |
| `interval` | candles, order book aggregation, prices, liquidation volumes, derivatives | `1m`, `1h`, `1d` and so on |
| `sortOrder` | dated modes | Newest first (default) or oldest first |
| `slippage`, `slippageRef` | slippage and order book aggregation | Order size in the quote asset, measured from the mid price or the best bid and ask |
| `includeExchanges`, `excludeExchanges`, `extrapolateMissingValues`, `priceMetrics`, `syntheticSources` | direct and synthetic price | Price calculation options |
| `rateParameters`, `rateDetail` | reference rates | Add composition and partition detail |
| `exchange`, `baseAsset`, `quoteAsset`, `optionType`, `minStrike`, `maxStrike` | contract details, instruments | Filters |
| `activeOnly` | instruments | Only instruments still trading |
| `region` | market data modes | `us` (default) or `eu` host |
| `maxResults` | all | Row cap for the whole run |
| `requestsPerMinute` | all | Pacing |
| `apiKey` | all | Your Kaiko API key, stored as a secret |

### How to get an API key

Kaiko issues API keys with a data subscription; contact Kaiko sales or your account manager. What you can read is what your packages include: Kaiko sells data per type (Level 1 and Level 2 aggregations or tick-level data, reference rates, derivatives, analytics) and per market type. Paste the key into the API key field or set the `DATA_API_KEY` environment secret. A run without a key ends cleanly with a message asking for one, before any request is sent.

### Example output

```json
{
  "mode": "countOhlcvVwap",
  "modeLabel": "OHLCV, VWAP and trade count",
  "recordType": "ohlcvVwapBar",
  "identifier": "cbse:spot:btc-usd",
  "found": true,
  "id": "cbse:spot:btc-usd|1605139200000|",
  "exchange": "cbse",
  "instrumentClass": "spot",
  "instrument": "btc-usd",
  "pair": null,
  "code": null,
  "name": null,
  "date": "2020-11-12T00:00:00.000Z",
  "price": 15880.01873841608,
  "volume": 14829.124546730012,
  "value": 15880.01873841608,
  "retrievedAt": "2026-10-09T09:12:40.511Z",
  "note": null,
  "timestamp": 1605139200000,
  "open": "15705.79",
  "high": "16185.87",
  "low": "15446.82",
  "close": "16139.93",
  "count": 95111
}
```

Values are taken from the provider's documentation example. Every provider field is passed through as the provider names it; the common columns are filled from it, with numbers that the provider sends as text converted in the common columns only. Times in milliseconds or nanoseconds are converted to an ISO `date`.

### FAQ

#### What is the Kaiko API?

Kaiko is a Paris-based crypto market data provider for institutions. Its REST API serves trade and order book data, aggregations, fair market value prices, Kaiko reference rates and indices, and derivatives and DeFi data collected from more than 100 centralised and decentralised exchanges. It is documented publicly at docs.kaiko.com. This actor wraps the most used read endpoints of that API; the docs and the live hosts were checked on 2026-10-09.

#### Do I need my own Kaiko API key?

Yes. This actor is bring your own API key and never ships one. The key is stored as an Apify secret, sent only in the documented `X-Api-Key` header, and kept out of every log line. Without a key the run stops immediately with a clear message and no charge.

#### How do I download historical OHLCV candles for Bitcoin?

Pick OHLCV candles, list `cbse:btc-usd` (Coinbase) or any other exchange and pair in the instruments field, set the interval (such as `1h` or `1d`) and the start and end times, and run. Each row is one candle with open, high, low, close and volume.

#### Where do I find exchange and instrument codes?

Run the exchanges mode for every exchange code (`cbse` Coinbase, `krkn` Kraken, `binc` Binance, `bfnx` Bitfinex, `drbt` Deribit, `okex` OKX) and the instruments mode with an exchange and base asset to list its instrument codes, the first and last trade time and the trade count. Spot instrument codes are always `base-quote`, such as `eth-usdt`.

#### Can I get order book depth and slippage?

Yes. Market depth snapshots give the bid and ask volume within 0.1 to 10 percent of the best price. Price slippage snapshots give the slippage of a market order of the size you set. Order book aggregation averages spread, mid price, depth and slippage over an interval. Order book modes cover spot markets.

#### What is the difference between direct and synthetic price?

Direct price is Kaiko's robust weighted median of one pair's trades across exchanges, for pairs that trade directly. Synthetic price converts through the most liquid intermediary pairs, so it also prices assets with no direct market in the quote asset you want. Both are fair market value prices used for valuation and accounting.

#### Does it cover futures, perpetuals and options?

Yes. Candles and trades work for any instrument class. Liquidations cover futures and perpetual futures. Derivatives price details give mark, index and last price; derivatives risk gives open interest, funding rates, implied volatility and greeks; contract details list the contracts of an exchange.

#### What do I pay?

Pay per result: 0.005 USD per candle, derivatives price, trade, liquidation or reference code; 0.01 USD per order book snapshot or aggregate, fair market value price, reference rate publication, liquidation volume interval or derivatives risk snapshot. Requests that find nothing are free. Your Kaiko subscription applies separately.

#### What happens if my key is wrong or my package does not cover a request?

Kaiko checks the key before anything else and answers 403. The run then ends cleanly with a status message saying the key or its entitlement was refused, before anything is charged. An instrument or pair the provider has no data for becomes a free row with the provider's own explanation, and the run goes on.

### Keyword map

crypto market data API, Kaiko API, crypto OHLCV API, Bitcoin historical price API, crypto candles API, crypto tick data, crypto trades API, VWAP crypto, order book depth API, crypto slippage, bid ask spread crypto, crypto liquidations API, funding rate API, open interest API, crypto options greeks, fair market value crypto price, crypto reference rate, BRR Bitcoin reference rate, crypto exchange list, crypto instrument codes, DEX trades API.

### Terms and data use

Your Kaiko license decides what you may do with the data, and this actor does not change it. Kaiko's standard terms license the data for the subscriber's internal business purposes, allow display to the subscriber's customers only without download, copy or storage, and allow only de minimis distribution; redistribution that could substitute for a Kaiko license is prohibited, and commercialising derived works needs Kaiko's consent. Keep the run's dataset private unless your Kaiko agreement allows sharing it.

Which routes were checked live: the reference data routes (assets, exchanges, instruments) answer without a key and were confirmed against an invented-route control. The market data host checks the key before it routes any path, so the market data routes come from Kaiko's own documentation and could not be confirmed by probing.

# Actor input Schema

## `mode` (type: `string`):

Candle, trade, order book, liquidation and derivatives modes read the instruments list. Direct and synthetic prices read pairs, liquidation volumes read assets and reference rates read index codes. Contract details, assets, exchanges and instruments need none of these.

## `instruments` (type: `array`):

Kaiko exchange and instrument codes as exchange:instrument, one per line: cbse:btc-usd (Coinbase), krkn:eth-usd (Kraken), binc:btc-usdt (Binance). Add a class to override the instrument class for one line: binc:perpetual-future:btc-usdt, okex:future:btcusdt250117. The instruments mode lists every valid code.

## `instrumentClass` (type: `string`):

Market type for the instruments list, and the class filter for the instruments and contract details modes. Order book modes read spot only; liquidations read futures and perpetual futures; derivatives modes switch spot to perpetual future.

## `pairs` (type: `array`):

Direct and synthetic prices. Base and quote asset codes, one per line: btc-usd, eth-eur, sol-usdt.

## `assets` (type: `array`):

Liquidation volumes. Kaiko asset codes, one per line: btc, eth, sol.

## `indexCodes` (type: `array`):

Reference rates. Kaiko rate tickers, one per line, such as KK_BRR_BTCUSD. Your Kaiko indices subscription decides which tickers you can read.

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

Inclusive start of the window, as YYYY-MM-DD or a UTC time such as 2026-01-31T12:00:00Z. Left empty, the provider serves its most recent data.

## `endTime` (type: `string`):

Exclusive end of the window, as YYYY-MM-DD (read as the end of that day) or a UTC time. Reference rates use the last 24 hours when no window is given.

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

Candles, order book aggregation and fair market value prices: any interval from 1s to 1d, such as 1m, 15m, 1h or 1d. Liquidation volumes: 1h to 1d. Derivatives price and risk: 1m, 1h, 4h or 1d.

## `sortOrder` (type: `string`):

Newest first keeps the most recent rows when the maximum results cap is reached.

## `slippage` (type: `number`):

Price slippage and order book aggregation. Order size in the quote asset (for example 100000 for a 100,000 USD market order) to compute the slippage for.

## `slippageRef` (type: `string`):

Price slippage and order book aggregation. Measure slippage from the mid price or from the best bid and ask.

## `includeExchanges` (type: `array`):

Direct and synthetic prices. Only use trades from these exchange codes, such as cbse, krkn, bfnx. Empty means all exchanges.

## `excludeExchanges` (type: `array`):

Direct and synthetic prices. Leave these exchange codes out of the calculation.

## `extrapolateMissingValues` (type: `boolean`):

Direct and synthetic prices. Fill intervals without trades with the last available price.

## `priceMetrics` (type: `boolean`):

Direct and synthetic prices. Add the 99 percent confidence interval and the stress market indicator.

## `syntheticSources` (type: `boolean`):

Synthetic price. Add the intermediary pair prices the synthetic price was built from.

## `rateParameters` (type: `boolean`):

Reference rates. Add the rate composition: exchanges and calculation window.

## `rateDetail` (type: `boolean`):

Reference rates. Add the partition data behind each publication: price, volume, trade count and the selected trade.

## `exchange` (type: `string`):

Contract details (required) and instruments (optional filter). A Kaiko exchange code such as drbt (Deribit), binc (Binance), okex (OKX), bbit (Bybit) or cbse (Coinbase).

## `baseAsset` (type: `string`):

Contract details and instruments. Filter by base asset code, such as btc.

## `quoteAsset` (type: `string`):

Contract details and instruments. Filter by quote asset code, such as usd or usdt.

## `optionType` (type: `string`):

Contract details for options. Calls, puts or both.

## `minStrike` (type: `number`):

Contract details for options. Lowest strike price.

## `maxStrike` (type: `number`):

Contract details for options. Highest strike price.

## `activeOnly` (type: `boolean`):

Instruments. Only instruments that are still trading.

## `region` (type: `string`):

Which Kaiko market data host to call. Both serve the same data; pick the one nearer your other systems. Reference rates always use the US host, as documented.

## `maxResults` (type: `integer`):

The most rows this run returns and charges for, across all instruments, pairs, assets or codes. Also the page size where the provider documents one, and the limit for the instruments mode.

## `requestsPerMinute` (type: `integer`):

Pacing. Kaiko allows 6000 requests a minute per key; the actor also waits and retries when the provider answers 429.

## `apiKey` (type: `string`):

Your own Kaiko API key, issued with a Kaiko data subscription. Stored as a secret and sent in the documented X-Api-Key header, never in a URL and never logged. You can instead set the DATA_API_KEY environment secret.

## Actor input object example

```json
{
  "mode": "ohlcv",
  "instruments": [
    "cbse:btc-usd"
  ],
  "instrumentClass": "spot",
  "pairs": [
    "btc-usd"
  ],
  "interval": "1d",
  "sortOrder": "desc",
  "slippageRef": "mid_price",
  "extrapolateMissingValues": false,
  "priceMetrics": false,
  "syntheticSources": false,
  "rateParameters": false,
  "rateDetail": false,
  "optionType": "any",
  "activeOnly": false,
  "region": "us",
  "maxResults": 500,
  "requestsPerMinute": 600
}
```

# Actor output Schema

## `records` (type: `string`):

One row per candle, trade, order book aggregate, liquidation, price, rate, derivatives snapshot, contract or reference code.

# 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 = {
    "instruments": [
        "cbse:btc-usd"
    ],
    "pairs": [
        "btc-usd"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nabeelbaghoor/crypto-ohlcv-trades-order-book-api").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 = {
    "instruments": ["cbse:btc-usd"],
    "pairs": ["btc-usd"],
}

# Run the Actor and wait for it to finish
run = client.actor("nabeelbaghoor/crypto-ohlcv-trades-order-book-api").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 '{
  "instruments": [
    "cbse:btc-usd"
  ],
  "pairs": [
    "btc-usd"
  ]
}' |
apify call nabeelbaghoor/crypto-ohlcv-trades-order-book-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nabeelbaghoor/crypto-ohlcv-trades-order-book-api"
        }
    }
}
```

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/ApoQOrZ3QVsnEphtU/builds/u7UcjCZsuGHzqAbvA/openapi.json
