Read a live crypto order book
curl --request GET \
--url https://api.darvas.app/v1/crypto/order-book \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.darvas.app/v1/crypto/order-book"
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', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"ticker": "BTC-USDT-SWAP",
"exchange": "darvas",
"market_type": "swap",
"constituents": [
"binance",
"bybit",
"hyperliquid",
"okx"
],
"venues": null,
"as_of": "2026-11-28T12:00:00.180Z",
"size_unit": "base",
"grouping": null,
"best_bid": 97810.4,
"best_ask": 97810.5,
"mid_price": 97810.45,
"spread": 0.1,
"spread_percent": 0.000102,
"depth": [
{
"percent": 0.5,
"bid_size": 182.4,
"ask_size": 141.9,
"bid_notional": 17752000.5,
"ask_notional": 13961000.2,
"bid_share": 0.5624
}
],
"bid_walls": [
{
"price": 97500,
"size": 38.6
}
],
"ask_walls": [
{
"price": 98200,
"size": 31.2
}
],
"bid_levels": 50,
"ask_levels": 50,
"sources": [
{
"exchange": "okx",
"ticker": "BTC-USDT-SWAP",
"status": "ok",
"as_of": "2026-11-28T12:00:00.120Z",
"best_bid": 97810.4,
"best_ask": 97810.5,
"bid_levels": 50,
"ask_levels": 50
}
],
"bids": [
{
"price": 97810.5,
"size": 4.21,
"notional": 411782.2
}
],
"asks": [
{
"price": 97810.5,
"size": 2.05,
"notional": 200511.53
}
]
}{
"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
Live L2 Crypto Order Book Depth & Spread API
Query live Level 2 crypto order book bids, asks, spread and depth imbalance from a single exchange or merged across multiple top crypto venues.
Read a live crypto order book
curl --request GET \
--url https://api.darvas.app/v1/crypto/order-book \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.darvas.app/v1/crypto/order-book"
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', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"ticker": "BTC-USDT-SWAP",
"exchange": "darvas",
"market_type": "swap",
"constituents": [
"binance",
"bybit",
"hyperliquid",
"okx"
],
"venues": null,
"as_of": "2026-11-28T12:00:00.180Z",
"size_unit": "base",
"grouping": null,
"best_bid": 97810.4,
"best_ask": 97810.5,
"mid_price": 97810.45,
"spread": 0.1,
"spread_percent": 0.000102,
"depth": [
{
"percent": 0.5,
"bid_size": 182.4,
"ask_size": 141.9,
"bid_notional": 17752000.5,
"ask_notional": 13961000.2,
"bid_share": 0.5624
}
],
"bid_walls": [
{
"price": 97500,
"size": 38.6
}
],
"ask_walls": [
{
"price": 98200,
"size": 31.2
}
],
"bid_levels": 50,
"ask_levels": 50,
"sources": [
{
"exchange": "okx",
"ticker": "BTC-USDT-SWAP",
"status": "ok",
"as_of": "2026-11-28T12:00:00.120Z",
"best_bid": 97810.4,
"best_ask": 97810.5,
"bid_levels": 50,
"ask_levels": 50
}
],
"bids": [
{
"price": 97810.5,
"size": 4.21,
"notional": 411782.2
}
],
"asks": [
{
"price": 97810.5,
"size": 2.05,
"notional": 200511.53
}
]
}{
"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
Query the live Level 2 order book of any supported crypto spot or perpetual swap market. By default (exchange=darvas), Darvas reads every constituent exchange of a Darvas pair simultaneously and merges resting bids and asks price level by price level. Every quantity is normalized to the base asset, including OKX perpetual contracts converted from contract counts into coins.
| Coverage | Details |
|---|---|
| Aggregated book | darvas (default) merges live OKX, Binance, Bybit and Hyperliquid books for a Darvas pair such as BTC-USDT-SWAP or BTC-ALLUSD |
| Single exchanges | okx, binance, bybit and hyperliquid (Hyperliquid perpetuals only, capped at 20 levels per side) |
| Market types | Spot and perpetual swap; dated futures and options return HTTP 400 |
| Depth range | depth from 1 to 400 levels per side (default 50), read from each constituent venue |
| Computed summary | Best bid and ask, mid price, spread, four percentage depth bands and the five largest bid and ask walls |
| MCP tool | get_crypto_order_book on the data API MCP server |
Parameters
Passticker for every call and refine aggregation, depth, price grouping or payload size with optional query parameters.
| Parameter | Type | Default | Description |
|---|---|---|---|
ticker | string | required | Darvas pair (such as BTC-USDT-SWAP) or exchange-native symbol (such as perpetual:BTCUSDT). |
exchange | string | darvas | Venue selector: darvas for merged cross-venue depth, or one of okx, binance, bybit, hyperliquid. |
market_type | string | inferred | Optional spot or swap disambiguator when a ticker string is ambiguous. |
venues | string | null | Comma-separated subset of exchanges to merge when exchange=darvas; rejected with 400 for single-exchange calls. |
depth | integer | 50 | Number of bid and ask levels to read per exchange and include in the response (1 to 400). |
grouping | number | null | Coarse price increment for bucketing levels, such as 10 for 10-dollar ticks on BTC. |
include_levels | string | true | Set false to omit raw bids and asks arrays while keeping all summary metrics and sources. |
Response fields
Top-of-book and spread
Top-of-book fields summarize execution cost at the touch across the chosen venue or merged book:best_bidandbest_ask: highest bid price and lowest ask price in the active book.mid_price: arithmetic midpoint betweenbest_bidandbest_ask.spreadandspread_percent:best_ask - best_bidand the spread as a percentage ofmid_price. On a mergeddarvasbook,spreadcan turn negative when one exchange’s best bid sits above another exchange’s best ask.
Depth bands and liquidity walls
Depth summaries measure resting liquidity away from the mid price without scanning raw level arrays on the client:- Percentage depth bands (
depth). Four buckets covering0.25%,0.5%,1%and2%frommid_price. Each bucket reportsbid_sizeandask_sizein base coins,bid_notionalandask_notionalin quote currency andbid_share(nullif both sides are empty). Raise thedepthquery parameter when wide bands need deeper exchange coverage. - Resting liquidity walls (
bid_walls,ask_walls). Lists up to the five largest price levels on each side withpriceandsize, sorted by resting size so large support and resistance clusters stand out immediately.
Price level grouping and summary mode
- Price bucketing (
grouping). Bids round down and asks round up onto the requested step so grouped levels never cross each other. When omitted, native exchange ticks remain intact and the payload echoesgrouping: null. - Lightweight polling (
include_levels=false). Returns emptybids: []andasks: []arrays while preservingbest_bid,best_ask,depth,bid_walls,ask_walls,bid_levels,ask_levelsandsources.
| Field | Description |
|---|---|
ticker, exchange, market_type, size_unit | Resolved instrument, venue mode, market type (spot or swap) and base size unit. |
constituents, venues | Present for exchange=darvas: all constituent venues of the pair and the applied venues filter (null when unfiltered). |
as_of, grouping | UTC timestamp of the newest venue book read, plus the active price grouping increment or null. |
bids, asks | Ordered level arrays (best price first), each item containing price, size and notional. |
bid_levels, ask_levels | Total bid and ask levels present in the built book before any include_levels=false trimming. |
sources | Per-exchange diagnostics carrying exchange, ticker, status, as_of, best prices and level counts. |
Exchange sources and error handling
Source status codes
Every element insources reports how each constituent exchange contributed to the response:
ok: Darvas read the live exchange order book and merged its levels into the output.unavailable: the exchange request failed at query time, so the merged book excludes that venue without failing the entire call.unsupported: the instrument trades on that exchange, but Darvas does not collect live L2 books from that venue.
HTTP status responses
400 Bad Request: invalid ticker, unsupported market type (such as dated futures or options), avenuesfilter on a non-darvasexchange, or a Darvas pair whose venues have no readable order books.404 Not Found: a single-exchange book returned an empty bid or ask side at the moment of the request.503 Service Unavailable: the requested single exchange failed, or every readable constituent exchange of a mergeddarvaspair failed simultaneously.
Related order-flow endpoints
- Historical resting liquidity over time:
/crypto/order-book/heatmap - Price-level aggressive volume and delta:
/crypto/footprintand/crypto/order-flow - Instrument discovery and Darvas pair definitions:
/crypto/tickers
Examples
Merged book with price grouping
Read a 200-level aggregatedBTC-USDT-SWAP book grouped onto 10-dollar ticks and inspect depth imbalance, venue status and resting walls.
import os
import requests
headers = {"X-API-KEY": os.environ["DARVAS_API_KEY"]}
book = requests.get(
"https://api.darvas.app/v1/crypto/order-book",
headers=headers,
params={"ticker": "BTC-USDT-SWAP", "depth": 200, "grouping": 10},
).json()
print("Mid:", book["mid_price"], "Spread %:", book["spread_percent"])
for band in book["depth"]:
print(f'{band["percent"]}% band: bid {band["bid_size"]} / ask {band["ask_size"]}, bid share {band["bid_share"]}')
for source in book["sources"]:
print(source["exchange"], source["status"], source["bid_levels"], source["ask_levels"])
print("Largest bid wall:", book["bid_walls"][0], "Largest ask wall:", book["ask_walls"][0])
Single-exchange summary without raw levels
Poll spread, depth bands and top walls across 400 levels of BinanceBTCUSDT perpetual while omitting the raw level lists for minimal payload size.
curl -H "X-API-KEY: $DARVAS_API_KEY" \
"https://api.darvas.app/v1/crypto/order-book?ticker=perpetual:BTCUSDT&exchange=binance&depth=400&include_levels=false"
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 a live crypto order book: one page.
The answer of GET /crypto/order-book.