Read order book imbalance history
curl --request GET \
--url https://api.darvas.app/v1/crypto/order-book/imbalance-history \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.darvas.app/v1/crypto/order-book/imbalance-history"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.darvas.app/v1/crypto/order-book/imbalance-history', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"ticker": "BTC-USDT",
"exchange": "okx",
"market_type": "spot",
"interval": "1H",
"band_tier": "1h",
"start_time": "2026-11-23T12:00:00.000Z",
"end_time": "2026-11-30T12:00:00.000Z",
"as_of": "2026-11-30T12:00:00.000Z",
"size_unit": "base",
"ranges_pct": [
0.5,
1,
2,
5
],
"order_sizes_usd": [
100000,
1000000
],
"summary": [
{
"range_pct": 1,
"complete_bars": 168,
"mean_imbalance_decimal": 0.0213,
"latest_imbalance_decimal": 0.060151
}
],
"bars": [
{
"time": "2026-11-30T11:00:00.000Z",
"time_milliseconds": 1796036400000,
"reference_price_usd": 96851.2,
"buckets": 60,
"samples": 3600,
"observed_reach_bid_pct": 4.8,
"observed_reach_ask_pct": 5.2,
"depth": [
{
"range_pct": 1,
"complete": true,
"bid_depth_base": 412.18,
"ask_depth_base": 365.4,
"bid_depth_usd": 39920000,
"ask_depth_usd": 35390000,
"imbalance_decimal": 0.060151,
"bid_ask_ratio": 1.128
}
],
"slippage": [
{
"order_size_usd": 1000000,
"buy_slippage_bps": 1.82,
"sell_slippage_bps": 2.04
}
]
}
],
"methodology": {
"imbalance": "(bid_depth_usd - ask_depth_usd) / (bid_depth_usd + ask_depth_usd), from -1 to 1."
}
}{
"error": "VALIDATION_ERROR",
"message": "Send ticker or cik"
}{
"error": "UNAUTHORIZED",
"message": "The API key is not valid"
}{
"error": "PLAN_REQUIRED",
"message": "The account of this key has no active data API plan"
}{
"error": "NOT_FOUND",
"message": "No company has this ticker or CIK"
}{
"error": "RATE_LIMITED",
"message": "Too many requests"
}{
"error": "INTERNAL_ERROR",
"message": "Something went wrong"
}{
"error": "UNAVAILABLE",
"message": "The data service is unavailable"
}Crypto Order Flow
Order Book Imbalance & Slippage History API
Get per-bar bid and ask depth around the mid, order book imbalance and market order slippage from books recorded every second on OKX, Binance and Bybit.
Read order book imbalance history
curl --request GET \
--url https://api.darvas.app/v1/crypto/order-book/imbalance-history \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.darvas.app/v1/crypto/order-book/imbalance-history"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.darvas.app/v1/crypto/order-book/imbalance-history', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"ticker": "BTC-USDT",
"exchange": "okx",
"market_type": "spot",
"interval": "1H",
"band_tier": "1h",
"start_time": "2026-11-23T12:00:00.000Z",
"end_time": "2026-11-30T12:00:00.000Z",
"as_of": "2026-11-30T12:00:00.000Z",
"size_unit": "base",
"ranges_pct": [
0.5,
1,
2,
5
],
"order_sizes_usd": [
100000,
1000000
],
"summary": [
{
"range_pct": 1,
"complete_bars": 168,
"mean_imbalance_decimal": 0.0213,
"latest_imbalance_decimal": 0.060151
}
],
"bars": [
{
"time": "2026-11-30T11:00:00.000Z",
"time_milliseconds": 1796036400000,
"reference_price_usd": 96851.2,
"buckets": 60,
"samples": 3600,
"observed_reach_bid_pct": 4.8,
"observed_reach_ask_pct": 5.2,
"depth": [
{
"range_pct": 1,
"complete": true,
"bid_depth_base": 412.18,
"ask_depth_base": 365.4,
"bid_depth_usd": 39920000,
"ask_depth_usd": 35390000,
"imbalance_decimal": 0.060151,
"bid_ask_ratio": 1.128
}
],
"slippage": [
{
"order_size_usd": 1000000,
"buy_slippage_bps": 1.82,
"sell_slippage_bps": 2.04
}
]
}
],
"methodology": {
"imbalance": "(bid_depth_usd - ask_depth_usd) / (bid_depth_usd + ask_depth_usd), from -1 to 1."
}
}{
"error": "VALIDATION_ERROR",
"message": "Send ticker or cik"
}{
"error": "UNAUTHORIZED",
"message": "The API key is not valid"
}{
"error": "PLAN_REQUIRED",
"message": "The account of this key has no active data API plan"
}{
"error": "NOT_FOUND",
"message": "No company has this ticker or CIK"
}{
"error": "RATE_LIMITED",
"message": "Too many requests"
}{
"error": "INTERNAL_ERROR",
"message": "Something went wrong"
}{
"error": "UNAVAILABLE",
"message": "The data service is unavailable"
}Overview
This endpoint returns, per bar, the resting bid and ask depth within each range of the book’s mid, its imbalance from -1 to 1, and the slippage a market order of each dollar size would have paid. It reads the books Darvas records every second on OKX, Binance and Bybit spot and perpetual markets, oldest bar first. A range iscomplete only where the stored book reached it on both sides; summary gives each range’s mean and newest imbalance over the complete bars.
| Coverage | Details |
|---|---|
| Venues | okx (default), binance and bybit, spot and perpetual swaps |
| Bars | 1m, 5m, 15m, 30m, 1H, 2H, 4H, 1D or 1W; 168 bars by default, 1,000 at most |
| Ranges | Up to 6 ranges from 0.05% to 10%; 0.5, 1, 2 and 5 by default |
| Order sizes | Up to 4 sizes in US dollars; 100,000 and 1,000,000 by default |
| MCP tool | get_crypto_order_book_imbalance_history on the data API MCP server |
Example
import os
import requests
headers = {"X-API-KEY": os.environ["DARVAS_API_KEY"]}
answer = requests.get(
"https://api.darvas.app/v1/crypto/order-book/imbalance-history",
headers=headers,
params={
"ticker": "BTC-USDT-SWAP",
"exchange": "okx",
"interval": "1H",
},
).json()
for bar in answer["bars"][-3:]:
depth = bar["depth"][1]
print(bar["time"], depth["range_pct"], depth["imbalance_decimal"], bar["slippage"][0]["buy_slippage_bps"])
curl -H "X-API-KEY: $DARVAS_API_KEY" \
"https://api.darvas.app/v1/crypto/order-book/imbalance-history?ticker=BTC-USDT-SWAP&exchange=okx&interval=1H"
Authorizations
apiKeybearerKey
Query Parameters
The instrument id: BTC-USDT or BTC-USDT-SWAP on OKX, ETH-USDC-SWAP on Hyperliquid, BTC-USD on Coinbase, spot:BTCUSDT or perpetual:BTCUSDT on Binance and Bybit. A Binance or Bybit symbol such as BTCUSDT also works with market_type, spot without it. A Darvas aggregated pair is BASE-QUOTE or BASE-QUOTE-SWAP, such as BTC-USDT-SWAP, or BTC-ALLUSD for one combining its USD, USDT and USDC markets.
Maximum string length:
64Pattern:
^[A-Za-z0-9][A-Za-z0-9._:/-]{0,63}$Response
Read order book imbalance history: one page.
The answer of GET /crypto/order-book/imbalance-history.